/* ================================================================
   Duo User Prober — Clean Modern UI
   ================================================================ */

/* --- Tokens: Light theme --- */
:root {
    --bg: #f0f2f5;
    --bg-soft: #f7f8fa;
    --panel-soft: #fafbfc;
    --ink: #1a1d21;
    --ink-secondary: #4a5568;
    --panel: #ffffff;
    --line: #e2e6ea;
    --line-strong: #cbd2d9;
    --accent: #f76902;
    --accent-soft: #fff4ec;
    --accent-strong: #d45a00;
    --accent-hover: #e56100;
    --button-bg: #d45a00;
    --button-bg-hover: #c05000;
    --button-bg-active: #a84700;
    --heading: #1a1d21;
    --muted: #6b7280;
    --good: #0f7b3f;
    --good-bg: #ecfdf3;
    --bad: #c53030;
    --bad-bg: #fff5f5;
    --warn: #b7791f;
    --warn-bg: #fefcbf;
    --stale-bg: #fef3c7;
    --stale-line: #d97706;
    --stale-ink: #92400e;
    --pill-success-text: #166534;
    --pill-success-bg: #dcfce7;
    --pill-failure-text: #991b1b;
    --pill-failure-bg: #fee2e2;
    --pill-deny-text: #92400e;
    --pill-deny-bg: #fef3c7;
    --pill-fraud-text: #9a3412;
    --pill-fraud-bg: #ffedd5;
    --warn-border: #f6e05e;
    --header-bg: #1a1d21;
    --header-border: #f76902;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-xs: 4px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --mono: "SFMono-Regular", "Cascadia Code", "Liberation Mono", Menlo, Consolas, monospace;
    --transition: 0.15s ease;
}

/* --- Tokens: Dark theme --- */
:root[data-theme="dark"] {
    --bg: #0f1117;
    --bg-soft: #161922;
    --panel-soft: #1c2030;
    --ink: #e8ecf1;
    --ink-secondary: #9ca3af;
    --panel: #1a1e2a;
    --line: #2a3040;
    --line-strong: #3d4658;
    --accent: #f76902;
    --accent-soft: #2a1a0a;
    --accent-strong: #ff8c3a;
    --accent-hover: #ff7a1a;
    --button-bg: #e56100;
    --button-bg-hover: #d45a00;
    --button-bg-active: #c05000;
    --heading: #f0f4f8;
    --muted: #8b95a5;
    --good: #34d399;
    --good-bg: #0a2618;
    --bad: #f87171;
    --bad-bg: #2a1018;
    --warn: #fbbf24;
    --warn-bg: #2a2008;
    --stale-bg: #2a2008;
    --stale-line: #d97706;
    --stale-ink: #fbbf24;
    --pill-success-text: #86efac;
    --pill-success-bg: rgba(34, 197, 94, 0.12);
    --pill-failure-text: #fca5a5;
    --pill-failure-bg: rgba(239, 68, 68, 0.12);
    --pill-deny-text: #fcd34d;
    --pill-deny-bg: rgba(245, 158, 11, 0.12);
    --pill-fraud-text: #fdba74;
    --pill-fraud-bg: rgba(249, 115, 22, 0.12);
    --warn-border: rgba(245, 158, 11, 0.2);
    --header-bg: #12141c;
    --header-border: #f76902;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
}

/* --- Reset --- */
* { box-sizing: border-box; }

/* --- Browser surfaces --- */
::selection {
    background: rgba(247, 105, 2, 0.2);
    color: var(--ink);
}
:root[data-theme="dark"] ::selection {
    background: rgba(255, 140, 58, 0.3);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

* {
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
}

input, textarea {
    caret-color: var(--accent);
}

/* --- Base --- */
body {
    margin: 0;
    color: var(--ink);
    font-family: "Google Sans Flex", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a {
    color: var(--accent-strong);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
}
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* --- Shell --- */
.shell {
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}

/* --- Masthead --- */
.masthead {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: var(--header-bg);
    border-bottom: 3px solid var(--header-border);
    color: #fff;
    margin: 0 -1.5rem;
}
.masthead h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.masthead-home {
    color: inherit;
}
.masthead-home:hover {
    color: inherit;
}
.masthead h2 {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
}
.masthead p {
    margin: 0.1rem 0 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}
.masthead .masthead-notice {
    display: inline-block;
    margin-top: 0.65rem;
    padding: 0.55rem 0.75rem;
    max-width: 55rem;
    color: #fff;
    background: rgba(247, 105, 2, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-left: 4px solid var(--header-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
}
.masthead .masthead-notice strong {
    font-weight: 700;
}

/* --- Navigation --- */
nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}
nav form { margin: 0; }
nav a, nav button, nav .feature-unavailable {
    font: inherit;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xs);
    padding: 0.4rem 0.7rem;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
nav a:hover, nav button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}
nav a:active, nav button:active {
    background: rgba(255, 255, 255, 0.22);
}
nav a:focus-visible, nav button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.hotkey {
    display: inline-block;
    min-width: 1.35em;
    margin-left: 0.25rem;
    padding: 0.05em 0.3em;
    border: 1px solid currentColor;
    border-radius: 3px;
    font: 600 0.75em/1.2 var(--mono);
    text-align: center;
    opacity: 0.65;
}
.subnav .active .hotkey {
    opacity: 0.85;
}

/* --- Theme toggle --- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
}
.theme-toggle-icon {
    width: 1rem;
    text-align: center;
}
.theme-toggle-egg {
    display: none;
}
:root[data-theme="dark"] .theme-toggle-sun {
    display: none;
}
:root[data-theme="dark"] .theme-toggle-egg {
    display: inline-block;
}

/* --- Panels --- */
.panel {
    margin-top: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
    transition: background-color var(--transition), border-color var(--transition);
}

/* --- Grid --- */
.grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* --- Stat cards --- */
.stat {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    transition: border-color var(--transition);
}
.stat:hover {
    border-color: var(--line-strong);
}
:root[data-theme="dark"] .stat {
    background: var(--panel-soft);
}
.stat .label {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.stat .value {
    display: block;
    margin-top: 0.35rem;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--heading);
}

/* --- Flash messages --- */
.flash {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
}
.flash.success { border-left-color: var(--good); background: var(--good-bg); }
.flash.error { border-left-color: var(--bad); background: var(--bad-bg); }

/* --- Error panel --- */
.error-panel {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--bad);
    border-radius: var(--radius-sm);
    background: var(--bad-bg);
    color: var(--bad);
    font-weight: 500;
}
.error-recovery {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--ink-secondary);
}
.error-recovery a {
    color: var(--accent-strong);
    font-weight: 600;
}

/* --- Tables --- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--panel);
}
.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-sm);
}
.table-wrap table {
    border-radius: 0;
}
th, td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    vertical-align: top;
    font-size: 0.9rem;
    overflow-wrap: break-word;
    border-bottom: 1px solid var(--line);
}
th {
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid var(--line);
}
:root[data-theme="dark"] th {
    background: var(--panel-soft);
}
tbody tr {
    transition: background-color 0.08s ease;
}
tbody tr:hover {
    background: var(--bg-soft);
}
tbody tr:last-child td {
    border-bottom: none;
}

/* --- Pills --- */
.pill {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 0.8rem;
    font-weight: 500;
    margin-right: 0.3rem;
    margin-bottom: 0.3rem;
}
:root[data-theme="dark"] .pill {
    background: rgba(247, 105, 2, 0.15);
}

/* --- Device flags & result pills --- */
.device-flag,
.result-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
    border: none;
}

/* Authenticator layout */
.device-authenticator {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.55rem;
}
.authenticator-visual {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex: 0 0 1.75rem;
    margin-top: 0.05rem;
}
.authenticator-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: #fff;
    padding: 0.1rem;
}
:root[data-theme="dark"] .authenticator-icon {
    border-color: var(--line-strong);
    background: #f4f7fb;
}

/* --- Status icons --- */
.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.9rem;
    height: 0.9rem;
    flex: 0 0 0.9rem;
}
.status-icon::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.62rem;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.result-pill.success .status-icon::before,
.device-flag.success .status-icon::before {
    content: "\f00c";
}
.result-pill.failure .status-icon::before,
.result-pill.deny .status-icon::before,
.device-flag.failure .status-icon::before {
    content: "\f00d";
}
.result-pill.fraud .status-icon::before,
.device-flag.stale .status-icon::before {
    content: "\f071";
}
.result-pill.neutral .status-icon::before,
.device-flag.neutral .status-icon::before {
    content: "\f128";
}

/* Result pill tones */
.result-pill.success {
    color: var(--pill-success-text);
    background: var(--pill-success-bg);
}
.result-pill.failure {
    color: var(--pill-failure-text);
    background: var(--pill-failure-bg);
}
.result-pill.deny {
    color: var(--pill-deny-text);
    background: var(--pill-deny-bg);
}
.result-pill.fraud {
    color: var(--pill-fraud-text);
    background: var(--pill-fraud-bg);
}
.result-pill.neutral {
    color: var(--muted);
    background: var(--bg-soft);
}

/* Device flag tones */
.device-flag.success {
    color: var(--pill-success-text);
    background: var(--pill-success-bg);
}
.device-flag.failure {
    color: var(--pill-failure-text);
    background: var(--pill-failure-bg);
}
.device-flag.neutral {
    color: var(--muted);
    background: var(--bg-soft);
}
.device-flag.stale {
    margin-top: 0.4rem;
    color: var(--stale-ink);
    background: var(--stale-bg);
}

/* --- Actions --- */
.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.actions form { margin: 0; }
.confirm-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.confirm-row[hidden] {
    display: none;
}
.confirm-message {
    font-size: 0.85rem;
    color: var(--ink-secondary);
    font-weight: 500;
}
.confirm-row .confirm-yes {
    background: var(--bad);
    color: #fff;
}
.confirm-row .confirm-yes:hover {
    background: var(--bad);
    filter: brightness(0.85);
}
.confirm-row .confirm-no {
    background: var(--panel);
    color: var(--ink-secondary);
    border: 1px solid var(--line);
}
.confirm-row .confirm-no:hover {
    background: var(--bg-soft);
    border-color: var(--line-strong);
}
.actions button, .search-form button, .login-form button {
    font: inherit;
    font-size: 0.9rem;
    border: none;
    background: var(--button-bg);
    color: #fff;
    padding: 0.55rem 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition), box-shadow var(--transition), transform var(--transition);
    box-shadow: var(--shadow-sm);
}
.actions button:hover, .search-form button:hover, .login-form button:hover {
    background: var(--button-bg-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.actions button:active, .search-form button:active, .login-form button:active {
    background: var(--button-bg-active);
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}
.actions button:focus-visible, .search-form button:focus-visible, .login-form button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.feature-unavailable {
    position: relative;
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.62;
}
.feature-unavailable:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.feature-unavailable[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    z-index: 100;
    left: 50%;
    bottom: calc(100% + 0.55rem);
    width: max-content;
    max-width: min(18rem, 75vw);
    padding: 0.45rem 0.65rem;
    border-radius: var(--radius-xs);
    background: var(--ink);
    color: var(--panel);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 0.25rem);
    transition: opacity var(--transition), transform var(--transition);
}
.feature-unavailable[data-tooltip]:hover::after,
.feature-unavailable[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}
.feature-unavailable-control {
    display: inline-flex;
    opacity: 1;
}
.actions .feature-unavailable-control button,
.actions .feature-unavailable-control button:hover {
    background: var(--muted);
    color: var(--panel);
    cursor: not-allowed;
    opacity: 0.62;
    box-shadow: none;
    transform: none;
}
.feature-unavailable-text {
    display: inline-block;
}
.feature-unavailable-panel {
    display: block;
    filter: grayscale(1);
}
.feature-unavailable-cell {
    color: var(--muted);
    background: var(--bg-soft);
}
.actions .secondary {
    background: var(--panel);
    color: var(--accent-strong);
    border: 1px solid var(--line);
}
.actions .secondary:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}
:root[data-theme="dark"] .actions .secondary {
    background: var(--panel-soft);
}
:root[data-theme="dark"] .actions .secondary:hover {
    background: var(--accent-soft);
}

/* --- Hint / Warning --- */
.hint {
    color: var(--muted);
    font-size: 0.85rem;
}
.warning {
    padding: 0.85rem 1rem;
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    border-left: 4px solid var(--warn);
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    color: var(--warn);
    font-weight: 500;
}

/* --- Forms --- */
.search-form, .login-form {
    display: grid;
    gap: 1rem;
}
label {
    font-weight: 600;
    display: block;
    font-size: 0.9rem;
    color: var(--ink-secondary);
}
input {
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.95rem;
    background: var(--panel);
    color: var(--ink);
    transition: border-color var(--transition), box-shadow var(--transition);
}
:root[data-theme="dark"] input {
    background: var(--bg);
}
input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(247, 105, 2, 0.15);
}
input:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(247, 105, 2, 0.15);
}

/* --- SSO button link --- */
.button-link {
    display: inline-block;
    font: inherit;
    font-size: 0.9rem;
    border: none;
    background: var(--button-bg);
    color: #fff;
    padding: 0.55rem 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition), box-shadow var(--transition), transform var(--transition);
    box-shadow: var(--shadow-sm);
}
.button-link:hover {
    background: var(--button-bg-hover);
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.button-link:active {
    background: var(--button-bg-active);
    color: #fff;
    transform: translateY(0);
}
.button-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- Subnav --- */
.subnav {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding: 0.3rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.subnav a, .subnav .feature-unavailable {
    text-decoration: none;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--muted);
    transition: background-color var(--transition), color var(--transition);
}
.subnav a:hover {
    background: var(--bg-soft);
    color: var(--ink);
    text-decoration: none;
}
.subnav a.active {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.subnav a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
:root[data-theme="dark"] .subnav {
    background: var(--panel);
}
:root[data-theme="dark"] .subnav a:hover {
    background: var(--panel-soft);
}
:root[data-theme="dark"] .subnav a.active {
    color: #fff;
}

/* --- Logins filter --- */
.logins-filter {
    display: inline-flex;
    gap: 0.25rem;
    margin-top: 0.75rem;
    padding: 0.25rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.filter-btn {
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background-color var(--transition), color var(--transition);
}
.filter-btn:hover {
    background: var(--panel);
    color: var(--ink);
}
.filter-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.filter-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.filter-btn .filter-count {
    margin-left: 0.25rem;
    opacity: 0.75;
}
:root[data-theme="dark"] .logins-filter {
    background: var(--panel-soft);
}
:root[data-theme="dark"] .filter-btn:hover {
    background: var(--panel);
}

/* --- Headings --- */
h2 {
    margin: 1.25rem 0 0.5rem;
    color: var(--heading);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
h2:first-child {
    margin-top: 0;
}
h3 {
    margin: 1.25rem 0 0.4rem;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

/* --- Local time tooltip --- */
.local-time {
    position: relative;
    white-space: nowrap;
    border-bottom: 1px dotted var(--line-strong);
    cursor: help;
}
:root[data-theme="dark"] .local-time {
    border-bottom-color: var(--accent-strong);
}
.local-time:hover::after,
.local-time:focus-visible::after {
    content: "UTC: " attr(data-utc);
    position: absolute;
    left: 0;
    top: calc(100% + 0.35rem);
    z-index: 5;
    min-width: max-content;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: var(--panel);
    color: var(--ink);
    box-shadow: var(--shadow-lg);
    font: 500 0.78rem/1.3 var(--mono);
}

/* --- Mono --- */
.mono {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

/* --- Identity block --- */
.identity {
    display: inline-flex;
    flex-direction: column;
    gap: 0.15rem;
}
.identity strong {
    font-size: 0.92rem;
}
.identity .hint {
    font-size: 0.8rem;
}

/* --- Meta stack --- */
.meta-stack {
    display: grid;
    gap: 0.15rem;
}
.meta-stack strong {
    color: var(--muted);
    font-weight: 600;
}

/* --- User card --- */
.user-card {
    display: grid;
    gap: 0.4rem;
}
.user-card .primary {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--heading);
}
.user-card .secondary {
    color: var(--muted);
}
.user-card strong {
    color: var(--muted);
    font-weight: 600;
}

/* --- External links --- */
.external-link {
    white-space: nowrap;
}

/* --- Nowrap / column widths --- */
.nowrap {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}
.factor-col {
    min-width: 11rem;
    overflow-wrap: normal;
    word-break: keep-all;
}
.ip-col {
    min-width: 10rem;
}

/* --- API panels --- */
.api-panels {
    display: grid;
    gap: 1rem;
}

/* --- JSON panel (details/summary) --- */
.json-panel {
    margin: 0;
}
.json-panel summary {
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    color: var(--heading);
    transition: color 0.1s ease;
}
.json-panel summary:hover {
    color: var(--accent);
}
.json-panel summary::-webkit-details-marker {
    display: none;
}
.json-panel summary::before {
    content: "\25B8";
    display: inline-block;
    margin-right: 0.45rem;
    transition: transform 0.15s ease;
}
.json-panel[open] summary::before {
    content: "\25BE";
}
.json-panel pre {
    margin: 0.85rem 0 0;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--ink);
    overflow-x: auto;
    font: 0.82rem/1.6 var(--mono);
    white-space: pre-wrap;
    word-break: break-word;
}

/* --- Map --- */
.map-shell {
    display: grid;
    gap: 1rem;
}
.map-frame {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    padding: 0.8rem;
    overflow: hidden;
}
.login-map-canvas {
    width: 100%;
    height: min(65vh, 38rem);
    min-height: 22rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    font: inherit;
}
.login-map-canvas.is-loading::before,
.login-map-canvas.is-error::before {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--muted);
    font: 500 0.95rem/1.4 inherit;
    text-align: center;
    padding: 1rem;
    content: attr(data-status);
}
.login-map-canvas .maplibregl-popup-content {
    margin: 0.8rem 0.95rem;
    color: var(--ink);
    font: inherit;
}
.login-map-canvas .maplibregl-popup-content strong {
    display: block;
    margin-bottom: 0.25rem;
}
.login-map-canvas .maplibregl-popup-content .meta {
    margin-top: 0.35rem;
    color: var(--muted);
    font: 0.82rem/1.35 var(--mono);
}
.map-summary {
    display: grid;
    gap: 0.4rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* --- Build metadata --- */
.page-meta {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}
.build-meta {
    display: grid;
    gap: 0.1rem;
    text-align: right;
    font: 500 0.68rem/1.3 var(--mono);
    color: var(--muted);
    opacity: 0.7;
}
.build-meta strong {
    color: var(--muted);
}
.build-meta .missing {
    opacity: 0.6;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* --- Mobile (<=700px) --- */
@media (max-width: 700px) {
    .shell { padding: 0 0.75rem 2rem; }
    .masthead { margin: 0 -0.75rem; padding: 0.75rem; align-items: start; flex-direction: column; }
    .panel { padding: 1rem 0.75rem; }
    nav { width: 100%; }
    nav a, nav button, nav .feature-unavailable { min-height: 44px; display: inline-flex; align-items: center; }
    .subnav { padding: 0.25rem; gap: 0.25rem; }
    .subnav a, .subnav .feature-unavailable { min-height: 44px; display: inline-flex; align-items: center; }
    .actions button, .search-form button, .login-form button, .button-link { min-height: 44px; }
    .page-meta {
        justify-content: flex-start;
    }
    .build-meta {
        text-align: left;
    }
    table, thead, tbody, th, td, tr { display: block; }
    table { border: none; border-radius: 0; }
    thead { display: none; }
    td { border: none; border-bottom: 1px solid var(--line); padding: 0.6rem 0.75rem; }
    tr { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 0.6rem; overflow: hidden; background: var(--panel); box-shadow: var(--shadow-sm); }
    tr:first-child { margin-top: 0; }
    .json-panel, .json-panel summary, .json-panel pre { display: block; }
    td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        margin-bottom: 0.2rem;
        color: var(--muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
}
