/* ==========================================================================
   JustLog3 Cloud — shared styles
   Design tokens, page shell, sidebar, and the base UI components (panels,
   metric cards, empty states, entrance motion) used by every dashboard page.
   Page-only styles live in their own file — see tasks.css for the Tasks page.
   ========================================================================== */

:root {
    --bg: #0b1118;
    --panel: rgba(17, 27, 37, 0.84);
    --line-rgb: 169, 193, 211;
    --line: rgba(var(--line-rgb), 0.14);
    --text: #eef5f4;
    --muted: #8da2ad;
    --muted-rgb: 141, 162, 173;
    --teal: #55d6bd;
    --blue: #75b8ff;
    --amber: #ffb777;
    --amber-rgb: 255, 183, 119;
    --teal-rgb: 85, 214, 189;
    --blue-rgb: 117, 184, 255;
    /* Errors and destructive actions. */
    --red-rgb: 255, 111, 97;
    /* Dark wells under the panels: inputs, code, overlays. */
    --inset-rgb: 5, 10, 14;
    --mono: "SFMono-Regular", Consolas, monospace;
    --content-max: 1120px;
    --main-pad-x: clamp(28px, 6vw, 92px);
    --sidebar-w: 248px;
    --sidebar-w-collapsed: 72px;
    /* Horizontal room the sidebar takes right now (full width or rail). */
    --sidebar-space: var(--sidebar-w);
    --radius-panel: 14px;
    --radius-control: 6px;
    /* Vertical rhythm between stacked dashboard sections. */
    --space-stack: 16px;
    /* Very quiet glow for cards under the pointer, see "Card hover glow". */
    --glow-hover: inset 0 0 0 1px rgba(var(--teal-rgb), 0.07), 0 18px 44px -30px rgba(var(--teal-rgb), 0.3);
    color-scheme: dark;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
}

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

html,
body {
    min-height: 100%;
    margin: 0;
}

::selection {
    background: var(--teal);
    color: #000;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
    border-radius: 2px;
}

.skip-link {
    position: fixed;
    z-index: 30;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-control);
    background: var(--teal);
    color: #07110f;
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 0.2s ease;
}

.skip-link:focus-visible {
    transform: translateY(0);
}

/* The skip link focuses <main>; it is a target, not a control. */
.dashboard-main:focus {
    outline: none;
}

body.dashboard-shell {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background: radial-gradient(circle at 32% 0, #182431 0, var(--bg) 42%, #06080b 100%);
    color: var(--text);
}

/* Ambient background glow ------------------------------------------------ */

.shell-glow {
    position: fixed;
    z-index: 0;
    width: 32rem;
    height: 32rem;
    border-radius: 50%;
    opacity: 0.1;
    filter: blur(100px);
    pointer-events: none;
}

.shell-glow-one {
    top: -22rem;
    left: 18%;
    background: var(--teal);
}

.shell-glow-two {
    right: -26rem;
    bottom: -18rem;
    background: var(--blue);
}

/* Sidebar ------------------------------------------------------------------ */

.sidebar {
    position: fixed;
    z-index: 2;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    width: var(--sidebar-w);
    flex-direction: column;
    padding: 28px 18px 20px;
    border-left: 1px solid var(--line);
    background: rgba(10, 17, 24, 0.92);
    backdrop-filter: blur(18px);
    transition: width 0.25s ease, padding 0.25s ease;
}

body.is-resizing-sidebar .sidebar,
body.is-resizing-sidebar .dashboard-main {
    transition: none;
}

/* While dragging, the cursor stays consistent and no text gets selected. */
body.is-resizing-sidebar,
body.is-moving-sidebar {
    user-select: none;
}

body.is-resizing-sidebar {
    cursor: ew-resize;
}

body.is-moving-sidebar,
body.is-moving-sidebar .sidebar-grip {
    cursor: grabbing;
}

/* Docked on the left: mirror edge, toggle and resize handle. */
html[data-sidebar-side="left"] .sidebar {
    right: auto;
    left: 0;
    border-right: 1px solid var(--line);
    border-left: 0;
}

html[data-sidebar-side="left"] .sidebar-toggle {
    right: -14px;
    left: auto;
}

html[data-sidebar-side="left"] .sidebar-resize-handle {
    right: -3px;
    left: auto;
}

html[data-sidebar-side="left"] .sidebar-toggle-icon {
    transform: rotate(-45deg);
}

html[data-sidebar-side="left"] .sidebar-toggle[aria-expanded="false"] .sidebar-toggle-icon {
    transform: rotate(135deg);
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sidebar-grip {
    display: grid;
    flex: none;
    width: 26px;
    height: 26px;
    place-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--muted);
    cursor: grab;
    font-size: 0.9rem;
    touch-action: none;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.sidebar-grip:hover,
.sidebar-grip:focus-visible {
    border-color: var(--line);
    color: var(--teal);
}

/* Where the sidebar will land when the grip is released. */
.sidebar-drop-preview {
    position: fixed;
    z-index: 25;
    top: 8px;
    bottom: 8px;
    width: var(--sidebar-space);
    border: 1px dashed rgba(var(--teal-rgb), 0.7);
    border-radius: var(--radius-panel);
    background: rgba(var(--teal-rgb), 0.08);
    pointer-events: none;
}

.sidebar-drop-preview[data-side="left"] {
    left: 8px;
}

.sidebar-drop-preview[data-side="right"] {
    right: 8px;
}

.sidebar-toggle {
    position: absolute;
    z-index: 3;
    top: 26px;
    left: -14px;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(10, 17, 24, 0.95);
    color: var(--muted);
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.sidebar-toggle:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.sidebar-toggle-icon {
    display: block;
    width: 7px;
    height: 7px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(135deg);
    transition: transform 0.25s ease;
}

.sidebar-toggle[aria-expanded="false"] .sidebar-toggle-icon {
    transform: rotate(-45deg);
}

.sidebar-resize-handle {
    position: absolute;
    z-index: 3;
    top: 0;
    bottom: 0;
    left: -3px;
    width: 6px;
    cursor: ew-resize;
    touch-action: none;
}

.sidebar-resize-handle::after {
    position: absolute;
    inset: 0 2px;
    background: var(--teal);
    opacity: 0;
    transition: opacity 0.2s ease;
    content: "";
}

.sidebar-resize-handle:hover::after,
.sidebar-resize-handle.is-dragging::after {
    opacity: 0.5;
}

.brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    color: var(--text);
    font-size: 0.86rem;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
}

/* A narrow sidebar truncates the wordmark instead of overflowing. */
.brand > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand strong {
    color: var(--teal);
    font-weight: 600;
}

.brand-mark {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(var(--teal-rgb), 0.7);
    color: var(--teal);
    font-family: var(--mono);
    font-weight: 700;
}

.workspace-label {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    margin: 58px 12px 14px;
}

.side-nav {
    display: grid;
    gap: 6px;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-left: 2px solid transparent;
    color: var(--muted);
    font-size: 0.91rem;
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.side-link:hover,
.side-link.is-active {
    border-left-color: var(--teal);
    background: rgba(var(--blue-rgb), 0.08);
    color: var(--text);
}

.nav-icon {
    width: 18px;
    color: var(--teal);
    font-size: 0.72rem;
    text-align: center;
}

.sidebar-bottom {
    margin-top: auto;
}

.layout-width {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 12px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
}

.layout-width-label {
    flex: 1;
    padding-left: 6px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.layout-width button {
    padding: 4px 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.7rem;
}

.layout-width button:hover {
    color: var(--text);
}

.layout-width button[aria-pressed="true"] {
    background: rgba(var(--teal-rgb), 0.14);
    color: var(--teal);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 4px 16px;
    border-top: 1px solid var(--line);
}

.avatar {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: rgba(var(--teal-rgb), 0.15);
    color: var(--teal);
    font-family: var(--mono);
}

.user-details {
    display: grid;
    flex: 1;
    min-width: 0;
    gap: 3px;
    /* Lets the plan badge adapt to the sidebar width (see @container below). */
    container-type: inline-size;
}

.user-identity {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
}

.user-details strong {
    overflow: hidden;
    color: var(--text);
    font-size: 0.84rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-details small {
    color: var(--muted);
    font-size: 0.7rem;
}

.user-plan-badge {
    display: flex;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    margin-top: 8px;
    padding: 0 9px;
    border: 1px solid rgba(var(--teal-rgb), 0.3);
    border-radius: 4px;
    background: rgba(var(--teal-rgb), 0.045);
    color: var(--teal);
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.user-plan-indicator {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    transform: rotate(45deg);
}

.user-plan-badge strong {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-plan-caption {
    flex: none;
    margin-left: auto;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.07em;
}

/* Narrow sidebar: drop the "CURRENT" caption before the plan name has to
   be truncated; the arrow then keeps the badge's right edge. */
@container (max-width: 150px) {
    .user-plan-caption {
        display: none;
    }

    .user-plan-arrow {
        margin-left: auto;
    }
}

.user-plan-arrow {
    flex: 0 0 auto;
    color: currentColor;
    font-size: 0.85rem;
}

.user-plan-badge.tier-starter {
    border-color: rgba(var(--teal-rgb), 0.45);
    background: linear-gradient(105deg, rgba(var(--teal-rgb), 0.1), rgba(var(--teal-rgb), 0.025));
}

.user-plan-badge.tier-expert {
    border-color: rgba(var(--blue-rgb), 0.35);
    color: var(--blue);
}

.user-plan-badge.tier-enterprise {
    border-color: rgba(var(--amber-rgb), 0.4);
    background: linear-gradient(105deg, rgba(var(--amber-rgb), 0.1), rgba(var(--amber-rgb), 0.025));
    color: var(--amber);
}

.user-plan-badge:hover,
.user-plan-badge:focus-visible {
    background: rgba(var(--teal-rgb), 0.09);
    box-shadow: 0 0 0 3px rgba(var(--teal-rgb), 0.08);
}

.user-plan-badge.tier-expert:hover,
.user-plan-badge.tier-expert:focus-visible {
    background: rgba(var(--blue-rgb), 0.1);
    box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.08);
}

.user-plan-badge.tier-enterprise:hover,
.user-plan-badge.tier-enterprise:focus-visible {
    background: rgba(var(--amber-rgb), 0.1);
    box-shadow: 0 0 0 3px rgba(var(--amber-rgb), 0.08);
}

.logout-button {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.logout-button:hover {
    border-color: var(--teal);
    color: var(--text);
}

/* Sidebar — collapsed (icon rail) state -------------------------------------*/

html.is-sidebar-collapsed {
    --sidebar-space: var(--sidebar-w-collapsed);
}

html.is-sidebar-collapsed .sidebar {
    width: var(--sidebar-w-collapsed);
    padding-inline: 12px;
    align-items: center;
}

/* The resize handle stays on the rail so it can be dragged open again. */

html.is-sidebar-collapsed .layout-width {
    display: none;
}

html.is-sidebar-collapsed .sidebar-top {
    flex-direction: column;
    gap: 12px;
}

html.is-sidebar-collapsed .brand,
html.is-sidebar-collapsed .user-card {
    justify-content: center;
}

html.is-sidebar-collapsed .side-link {
    justify-content: center;
    padding-inline: 0;
}

html.is-sidebar-collapsed .side-link > span:not(.nav-icon),
html.is-sidebar-collapsed .brand span:last-child,
html.is-sidebar-collapsed .workspace-label,
html.is-sidebar-collapsed .user-details,
html.is-sidebar-collapsed .logout-button span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
    border: 0;
}

/* Main content shell -------------------------------------------------------*/

.dashboard-main {
    position: relative;
    z-index: 1;
    width: calc(100% - var(--sidebar-space));
    min-height: 100vh;
    min-height: 100dvh;
    padding: 64px var(--main-pad-x) 80px;
    transition: width 0.25s ease, margin 0.25s ease, padding 0.25s ease;
}

html[data-sidebar-side="left"] .dashboard-main {
    margin-left: var(--sidebar-space);
}

.page {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
}

/* Content width chosen in the sidebar. Wider modes also shrink the side
   padding, otherwise on laptop screens the padding (not max-width) is
   what limits the page and "Wide" looks identical to "Fit". */
html[data-content-width="wide"] {
    --content-max: 1480px;
    --main-pad-x: clamp(24px, 3vw, 48px);
}

html[data-content-width="full"] {
    --content-max: none;
    --main-pad-x: 24px;
}

/* Shared typography ---------------------------------------------------------*/

.eyebrow {
    margin: 0 0 12px;
    color: var(--teal);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 680px;
    margin-bottom: 13px;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.03;
}

h2 {
    margin-bottom: 9px;
    font-size: 1.25rem;
}

.header-copy,
.panel-copy {
    max-width: 610px;
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.65;
}

.panel-badge,
.empty-state-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.66rem;
    white-space: nowrap;
}

.telegram-widget {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    margin-bottom: var(--space-stack);
    padding: 22px 24px;
    gap: 18px;
    border: 1px solid rgba(var(--teal-rgb), 0.3);
    border-radius: var(--radius-panel);
    background:
        linear-gradient(105deg, rgba(var(--teal-rgb), 0.13), transparent 52%),
        linear-gradient(285deg, rgba(var(--amber-rgb), 0.1), transparent 44%),
        var(--panel);
}

.telegram-widget.is-connected {
    padding-block: 16px;
}

.telegram-widget.is-connected .telegram-widget-mark {
    width: 38px;
}

.telegram-widget-mark {
    display: grid;
    width: 46px;
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid rgba(var(--teal-rgb), 0.4);
    border-radius: 10px;
    background: rgba(var(--teal-rgb), 0.12);
    color: var(--teal);
    font-size: 1.25rem;
}

.telegram-widget-copy h2 {
    margin-bottom: 6px;
}

.telegram-connection-status {
    margin-bottom: 6px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
}

.telegram-connection-status.is-connected {
    color: var(--teal);
}

.telegram-widget-copy p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.55;
}

.telegram-widget-copy code {
    color: var(--text);
}

.telegram-widget-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.telegram-widget-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 1px solid rgba(var(--teal-rgb), 0.45);
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--teal);
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.telegram-widget-link[hidden] {
    display: none;
}

.telegram-widget-link.is-secondary {
    border-color: rgba(var(--amber-rgb), 0.35);
    background: rgba(var(--amber-rgb), 0.04);
    color: var(--amber);
    cursor: pointer;
    font: inherit;
}

.telegram-widget-link:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.telegram-link-note {
    width: 100%;
    color: var(--muted);
    font-size: 0.68rem;
    text-align: right;
}

.telegram-widget-link:hover {
    background: var(--teal);
    color: #07110f;
}

/* Metric cards — shared by the overview and tasks pages --------------------*/

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    width: 100%;
    margin-bottom: var(--space-stack);
    gap: var(--space-stack);
}

.metric-card,
.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    background: var(--panel);
}

.metric-card {
    min-height: 154px;
    padding: 22px;
    transition: border-color 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.accent-card {
    border-color: rgba(var(--teal-rgb), 0.34);
    background: linear-gradient(135deg, rgba(var(--teal-rgb), 0.12), var(--panel));
}

.hot-metric {
    border-color: rgba(var(--amber-rgb), 0.32);
    background: linear-gradient(135deg, rgba(var(--amber-rgb), 0.1), var(--panel));
}

.hot-metric .metric-icon {
    color: var(--amber);
}

.metric-heading {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.metric-icon {
    color: var(--teal);
}

.metric-card strong {
    display: block;
    margin-bottom: 7px;
    font-size: 1.2rem;
    font-weight: 500;
}

.metric-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.77rem;
    line-height: 1.5;
}

/* Panel ---------------------------------------------------------------------*/

.panel {
    padding: 28px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

/* Empty state — shared by the log stream and the task queue -----------------*/

.logs-empty {
    display: grid;
    place-items: center;
    padding: 38px 18px 24px;
    text-align: center;
}

.empty-mark {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    margin-bottom: 16px;
    border: 1px dashed rgba(var(--teal-rgb), 0.5);
    color: var(--teal);
}

.logs-empty h3 {
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 500;
}

.logs-empty p {
    max-width: 380px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

/* ==========================================================================
   Overview page
   ========================================================================== */

.dashboard-header {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 60px;
    gap: 28px;
}

.dashboard-header::after {
    position: absolute;
    bottom: -22px;
    left: 0;
    width: 72px;
    height: 1px;
    background: linear-gradient(90deg, var(--teal), transparent);
    content: "";
}

/* Help entry point, right side of the overview header. */
.help-button {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 12px;
    padding: 10px 14px 10px 10px;
    border: 1px solid rgba(var(--teal-rgb), 0.32);
    border-radius: var(--radius-panel);
    background: linear-gradient(135deg, rgba(var(--teal-rgb), 0.1), var(--panel));
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
}

.help-button:hover {
    border-color: rgba(var(--teal-rgb), 0.6);
    background-color: rgba(var(--teal-rgb), 0.08);
}

.help-button:active {
    transform: scale(0.98);
}

.help-button:focus-visible {
    border-radius: var(--radius-panel);
}

.help-button-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(var(--teal-rgb), 0.5);
    border-radius: 50%;
    background: rgba(var(--teal-rgb), 0.14);
    color: var(--teal);
    font-family: var(--mono);
    font-size: 0.95rem;
    font-weight: 700;
}

.help-button-text {
    display: grid;
    gap: 2px;
}

.help-button-text strong {
    font-size: 0.86rem;
    font-weight: 600;
}

.help-button-text span {
    color: var(--muted);
    font-size: 0.72rem;
}

.help-button-arrow {
    margin-left: 4px;
    color: var(--teal);
    transition: transform 0.2s ease;
}

.help-button:hover .help-button-arrow {
    transform: translateX(3px);
}

.workspace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    width: 100%;
    margin-bottom: var(--space-stack);
    gap: var(--space-stack);
}

.activity-panel {
    position: relative;
    width: 100%;
    margin-bottom: var(--space-stack);
    overflow: hidden;
    padding: 24px 28px 22px;
    border-color: rgba(var(--teal-rgb), 0.22);
    background:
        radial-gradient(ellipse at 82% 0, rgba(var(--teal-rgb), 0.13), transparent 38%),
        linear-gradient(115deg, rgba(21, 39, 47, 0.94), rgba(14, 23, 32, 0.97) 55%, rgba(26, 31, 38, 0.94));
}

.activity-panel::before {
    position: absolute;
    top: 0;
    right: 28px;
    width: 84px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--teal));
    content: "";
}

.activity-heading {
    align-items: center;
}

.activity-heading h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 500;
}

.activity-heading .eyebrow {
    margin-bottom: 6px;
}

.activity-window {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.7rem;
}

.activity-summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px 30px;
    margin: 22px 0 10px;
}

.activity-summary div {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.activity-summary strong {
    color: var(--text);
    font-family: var(--mono);
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.activity-summary span {
    color: var(--muted);
    font-size: 0.75rem;
}

.activity-chart {
    display: grid;
    height: 194px;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 8px;
}

.activity-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 7px 0 28px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.activity-plot {
    position: relative;
    min-width: 0;
    height: 100%;
}

.activity-grid-lines {
    position: absolute;
    inset: 7px 0 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.activity-grid-lines span {
    border-top: 1px dashed rgba(var(--line-rgb), 0.16);
}

.activity-grid-lines span:last-child {
    border-top-style: solid;
    border-color: rgba(var(--teal-rgb), 0.38);
}

.activity-bars {
    position: absolute;
    z-index: 1;
    inset: 7px 0 28px;
    display: grid;
    grid-template-columns: repeat(16, minmax(0, 1fr));
    align-items: end;
    gap: clamp(3px, 0.65vw, 9px);
}

.activity-bar-column {
    position: relative;
    display: flex;
    min-width: 0;
    height: 100%;
    align-items: end;
    justify-content: center;
    outline-offset: 3px;
}

.activity-bar-column:focus-visible {
    outline: 1px solid var(--teal);
}

.activity-bar-column::after {
    position: absolute;
    z-index: 3;
    top: 4px;
    left: 50%;
    padding: 4px 7px;
    border: 1px solid rgba(var(--teal-rgb), 0.35);
    background: #101a20;
    color: var(--text);
    content: attr(data-tooltip);
    font-family: var(--mono);
    font-size: 0.68rem;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 3px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
}

.activity-bar-column:first-child::after {
    left: 0;
    transform: translate(0, 3px);
}

.activity-bar-column:last-child::after {
    right: 0;
    left: auto;
    transform: translate(0, 3px);
}

.activity-bar-column:hover::after,
.activity-bar-column:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.activity-bar-column:first-child:hover::after,
.activity-bar-column:first-child:focus-visible::after,
.activity-bar-column:last-child:hover::after,
.activity-bar-column:last-child:focus-visible::after {
    transform: translate(0, 0);
}

.activity-bar {
    display: block;
    width: min(100%, 24px);
    height: var(--bar-height, 0%);
    border: 1px solid rgba(207, 255, 243, 0.2);
    border-bottom: 0;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg, #c6fff0 0%, var(--teal) 34%, #328f8b 100%);
    box-shadow: 0 0 20px rgba(var(--teal-rgb), 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.32);
    opacity: 0.9;
    transition: height 0.35s ease, opacity 0.2s ease, filter 0.2s ease;
}

.activity-bar-column:hover .activity-bar,
.activity-bar-column:focus-visible .activity-bar {
    filter: brightness(1.18);
    opacity: 1;
}

.activity-bar-column.is-empty .activity-bar {
    height: 2px;
    border: 0;
    border-radius: 0;
    background: rgba(var(--line-rgb), 0.28);
    box-shadow: none;
    opacity: 1;
}

.activity-bar-column.is-current::before {
    position: absolute;
    inset: 0 auto 0 50%;
    border-left: 1px solid rgba(var(--blue-rgb), 0.34);
    content: "";
    pointer-events: none;
}

.activity-bar-column.is-current .activity-bar {
    background: linear-gradient(180deg, #effffb 0%, var(--blue) 100%);
    box-shadow: 0 0 22px rgba(var(--blue-rgb), 0.3), inset 0 1px 0 #fff;
}

.activity-bar-column.is-peak:not(.is-current) .activity-bar {
    background: linear-gradient(180deg, #ffe0bd 0%, var(--amber) 42%, #bb7448 100%);
    box-shadow: 0 0 20px rgba(var(--amber-rgb), 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.activity-time-labels {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(16, minmax(0, 1fr));
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
}

.activity-time-labels span {
    min-height: 13px;
    white-space: nowrap;
}

.activity-time-labels span:last-child {
    text-align: right;
}

/* When the workspace has no events yet, lead with the quickstart panel
   instead of the token panel — same markup, just a different order. */
.workspace-grid[data-onboarding="true"] .token-panel {
    order: 2;
}

.workspace-grid[data-onboarding="true"] .quickstart-panel {
    order: 1;
}

.quickstart-panel.is-highlighted {
    border-color: rgba(var(--teal-rgb), 0.4);
    box-shadow: 0 0 0 1px rgba(var(--teal-rgb), 0.12);
}

.quickstart-steps {
    display: grid;
    margin: 20px 0;
    padding: 0;
    gap: 10px;
    list-style: none;
}

.quickstart-steps li {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
}

.quickstart-step-index {
    display: grid;
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(var(--teal-rgb), 0.4);
    border-radius: 50%;
    color: var(--teal);
    font-family: var(--mono);
    font-size: 0.68rem;
}

.quickstart-steps .code-block {
    margin: 0;
}

.quickstart-command {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    background: rgba(var(--inset-rgb), 0.64);
}

.quickstart-command code {
    min-width: 0;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.quickstart-command .copy-button {
    padding: 7px 10px;
    font-size: 0.7rem;
}

.first-event-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.first-event-note::before {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 10px rgba(var(--amber-rgb), 0.5);
    content: "";
}

.task-summary-panel {
    display: grid;
    grid-template-columns: minmax(190px, 0.72fr) minmax(0, 1.28fr);
    align-items: center;
    width: 100%;
    margin-bottom: var(--space-stack);
    overflow: hidden;
    background:
        linear-gradient(112deg, rgba(var(--teal-rgb), 0.09), transparent 42%),
        var(--panel);
}

.task-progress-block {
    padding: 4px 28px 4px 0;
}

.task-progress-number {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 20px 0 14px;
    color: var(--muted);
    font-size: 0.75rem;
}

.task-progress-number strong {
    display: flex;
    align-items: baseline;
    color: var(--teal);
    font-family: var(--mono);
    font-size: 2.7rem;
    font-weight: 500;
    line-height: 1;
}

.task-progress-number strong .task-progress-percent {
    font-size: 1.2rem;
}

.task-progress-track {
    height: 5px;
    overflow: hidden;
    background: rgba(var(--line-rgb), 0.15);
}

.task-progress-track span {
    display: block;
    width: var(--completion);
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--blue));
    transform: scaleX(0);
    transform-origin: left;
    animation: task-progress-in 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) 0.15s forwards;
}

@keyframes task-progress-in {
    to { transform: scaleX(1); }
}

.task-progress-caption {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.72rem;
}

.task-focus-list {
    min-width: 0;
    padding-left: 28px;
    border-left: 1px solid var(--line);
}

.task-focus-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.task-focus-heading .eyebrow {
    margin-bottom: 6px;
}

.task-focus-heading h3 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 500;
}

.task-focus-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    padding: 9px 11px;
    border: 1px solid rgba(var(--teal-rgb), 0.38);
    color: var(--teal);
    font-size: 0.75rem;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.task-focus-link span:last-child {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.task-focus-link:hover {
    border-color: var(--teal);
    background: rgba(var(--teal-rgb), 0.1);
    transform: translateY(-2px);
}

.task-focus-link:hover span:last-child {
    transform: translate(2px, -2px);
}

.task-focus-items {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.task-focus-item {
    display: flex;
    min-width: 0;
    min-height: 40px;
    align-items: center;
    gap: 11px;
    padding: 8px 11px;
    border: 1px solid rgba(var(--line-rgb), 0.1);
    border-left: 2px solid var(--line);
    background: rgba(var(--inset-rgb), 0.34);
    animation: task-focus-in 0.4s ease backwards;
    animation-delay: calc(var(--row-index, 0) * 75ms);
}

.task-focus-item.is-priority {
    border-left-color: var(--amber);
}

.task-focus-index {
    flex: 0 0 auto;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.65rem;
}

.task-focus-title {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-focus-priority {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--amber);
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.task-focus-empty {
    display: flex;
    min-height: 88px;
    align-items: center;
    gap: 13px;
    padding: 14px;
    border: 1px dashed rgba(var(--teal-rgb), 0.24);
    color: var(--teal);
}

.task-focus-empty > span {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(var(--teal-rgb), 0.4);
}

.task-focus-empty p {
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

@keyframes task-focus-in {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

.token-field {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    background: rgba(var(--inset-rgb), 0.64);
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.token-field.is-copied {
    border-color: rgba(var(--teal-rgb), 0.5);
    background: rgba(var(--teal-rgb), 0.08);
}

.token-field code {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    color: var(--blue);
    font-family: var(--mono);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visibility-button,
.copy-button {
    flex: 0 0 auto;
    border: 1px solid rgba(var(--teal-rgb), 0.45);
    background: rgba(var(--teal-rgb), 0.1);
    color: var(--teal);
    cursor: pointer;
    font: inherit;
    font-size: 0.76rem;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.visibility-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
}

.eye-icon {
    position: relative;
    display: inline-block;
    width: 15px;
    height: 10px;
    border: 1.5px solid currentColor;
    border-radius: 70% 30%;
    transform: rotate(-45deg);
}

.eye-icon::after {
    position: absolute;
    top: 2px;
    left: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.copy-button {
    padding: 8px 13px;
}

.visibility-button:hover,
.copy-button:hover {
    background: rgba(var(--teal-rgb), 0.18);
}

.visibility-button:active,
.copy-button:active {
    transform: scale(0.96);
}

.token-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.rotate-button {
    padding: 7px 10px;
    border: 1px solid rgba(var(--amber-rgb), 0.35);
    background: rgba(var(--amber-rgb), 0.06);
    color: var(--amber);
    cursor: pointer;
    font: inherit;
    font-size: 0.72rem;
}

.rotate-button:hover,
.rotate-button:focus-visible {
    border-color: var(--amber);
    background: rgba(var(--amber-rgb), 0.12);
}

.rotate-button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.token-actions span {
    color: var(--muted);
    font-size: 0.7rem;
}

.code-block {
    margin: 22px 0;
    padding: 13px 14px;
    overflow-x: auto;
    background: rgba(var(--inset-rgb), 0.64);
    font-family: var(--mono);
    font-size: 0.76rem;
    white-space: pre;
}

.text-link {
    color: var(--blue);
    font-size: 0.82rem;
    text-decoration: none;
}

.text-link span {
    display: inline-block;
    margin-left: 5px;
    transition: transform 0.2s ease;
}

.text-link:hover span {
    transform: translateX(3px);
}

.logs-panel {
    width: 100%;
    min-height: 300px;
}

.logs-panel-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.logs-table-wrap {
    overflow-x: auto;
    margin-top: 24px;
}

.logs-table-wrap:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 4px;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    text-align: left;
}

.logs-table th {
    padding: 0 14px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.logs-table td {
    max-width: 320px;
    padding: 13px 14px;
    border-bottom: 1px solid rgba(var(--line-rgb), 0.08);
    color: var(--muted);
    vertical-align: top;
}

.logs-table tbody tr:last-child td {
    border-bottom: 0;
}

.logs-table .log-cell-time,
.logs-table .log-cell-logger {
    color: var(--text);
    white-space: nowrap;
}

.logs-table .log-payload {
    color: var(--text);
    font-family: var(--mono);
    white-space: pre-wrap;
    word-break: break-word;
}

.session-id-preview {
    display: block;
    overflow-wrap: anywhere;
}

.session-details-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 9px;
    border: 1px solid rgba(var(--blue-rgb), 0.28);
    background: rgba(var(--blue-rgb), 0.08);
    color: var(--blue);
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    font-size: 0.7rem;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.session-details-link:hover {
    border-color: var(--teal);
    background: rgba(var(--teal-rgb), 0.1);
    color: var(--teal);
}

.session-details-link span {
    transition: transform 0.2s ease;
}

.session-details-link:hover span {
    transform: translateX(3px);
}

.ai-panel {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    border-color: rgba(var(--blue-rgb), 0.25);
    background: linear-gradient(110deg, rgba(var(--blue-rgb), 0.11), var(--panel) 48%);
}

.ai-panel .panel-copy {
    max-width: 650px;
}

.ai-panel-action {
    white-space: nowrap;
}

.ai-mark {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid rgba(var(--blue-rgb), 0.45);
    border-radius: 12px;
    background: rgba(var(--blue-rgb), 0.1);
    color: var(--blue);
    font-size: 1.2rem;
}

/* ==========================================================================
   Toasts (copy confirmations and other brief status messages)
   ========================================================================== */

.toast-container {
    position: fixed;
    z-index: 20;
    left: 24px;
    bottom: 24px;
    display: grid;
    gap: 8px;
    pointer-events: none;
}

/* Keep toasts on the side away from the sidebar. */
html[data-sidebar-side="left"] .toast-container {
    right: 24px;
    left: auto;
}

.toast {
    padding: 10px 14px;
    border: 1px solid rgba(var(--teal-rgb), 0.35);
    border-radius: 6px;
    background: rgba(10, 17, 24, 0.96);
    color: var(--text);
    font-size: 0.8rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Entrance motion, page transitions, and reduced motion
   ========================================================================== */

.reveal-item,
.reveal-group > * {
    animation: dashboard-reveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.reveal-group > :nth-child(2) {
    animation-delay: 0.08s;
}

.reveal-group > :nth-child(3) {
    animation-delay: 0.16s;
}

@keyframes dashboard-reveal {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* The sidebar keeps a stable identity across full-page navigations, so
   supporting browsers cross-fade the page body while the sidebar itself
   stays put. No-op in browsers that don't support it yet. */
@supports (view-transition-name: none) {
    .sidebar {
        view-transition-name: sidebar;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .sidebar {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
        max-height: 100vh;
        padding: 14px 18px;
        overflow-y: auto;
        border-right: 0;
        border-left: 0;
        border-bottom: 1px solid var(--line);
        transition: max-height 0.25s ease, padding 0.25s ease;
    }

    .sidebar-resize-handle {
        display: none;
    }

    .sidebar-toggle {
        top: 12px;
        right: 18px;
        left: auto;
        display: grid;
        width: 38px;
        height: 38px;
        border-radius: 4px;
    }

    .sidebar-toggle-icon {
        position: relative;
        width: 15px;
        height: 1px;
        border: 0;
        border-radius: 0;
        background: currentColor;
        transform: none;
    }

    .sidebar-toggle-icon::before,
    .sidebar-toggle-icon::after {
        position: absolute;
        right: 0;
        left: 0;
        height: 1px;
        background: currentColor;
        content: "";
        transition: top 0.2s ease, transform 0.2s ease;
    }

    .sidebar-toggle-icon::before {
        top: -5px;
    }

    .sidebar-toggle-icon::after {
        top: 5px;
    }

    .sidebar-toggle[aria-expanded="false"] .sidebar-toggle-icon {
        transform: none;
    }

    .sidebar-toggle[aria-expanded="true"] .sidebar-toggle-icon {
        background: transparent;
        transform: none;
    }

    .sidebar-toggle[aria-expanded="true"] .sidebar-toggle-icon::before {
        top: 0;
        transform: rotate(45deg);
    }

    .sidebar-toggle[aria-expanded="true"] .sidebar-toggle-icon::after {
        top: 0;
        transform: rotate(-45deg);
    }

    html.is-mobile-nav-collapsed .sidebar {
        max-height: 66px;
        overflow: hidden;
    }

    html.is-sidebar-collapsed .sidebar,
    html.is-sidebar-collapsed .dashboard-main {
        width: 100%;
    }

    /* On phones the sidebar is a top bar: docking side does not apply. */
    html[data-sidebar-side] .sidebar {
        border-right: 0;
        border-left: 0;
    }

    html[data-sidebar-side] .dashboard-main {
        margin-left: 0;
    }

    html[data-sidebar-side] .sidebar-toggle {
        right: 18px;
        left: auto;
    }

    html[data-sidebar-side] .sidebar-toggle[aria-expanded] .sidebar-toggle-icon {
        transform: none;
    }

    .sidebar-grip {
        display: none;
    }

    .workspace-label {
        margin-top: 28px;
    }

    .sidebar-bottom {
        margin-top: 28px;
    }

    .dashboard-main {
        width: 100%;
        padding: 46px 24px 60px;
    }

    .activity-chart {
        height: 184px;
    }
}

@media (max-width: 640px) {
    .dashboard-header,
    .workspace-grid {
        display: block;
    }

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

    .dashboard-header .help-button {
        margin-top: 20px;
    }

    .activity-panel {
        padding: 20px 18px 18px;
    }

    .activity-chart {
        height: 170px;
        grid-template-columns: 30px minmax(0, 1fr);
        gap: 6px;
    }

    .activity-bars {
        gap: 3px;
    }

    .activity-summary {
        gap: 8px 18px;
    }

    .quickstart-command {
        align-items: stretch;
        flex-direction: column;
    }

    .quickstart-command .copy-button {
        align-self: flex-end;
    }

    .telegram-widget {
        grid-template-columns: auto minmax(0, 1fr);
        padding: 18px;
        gap: 14px;
    }

    .telegram-widget-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .telegram-link-note {
        text-align: left;
    }

    .workspace-grid .panel + .panel {
        margin-top: var(--space-stack);
    }

    .task-summary-panel {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .task-progress-block {
        padding: 0;
    }

    .task-focus-list {
        padding: 20px 0 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .task-focus-heading {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .ai-panel {
        grid-template-columns: auto 1fr;
    }

    .ai-panel-action {
        grid-column: 2;
        justify-self: start;
    }

    .panel {
        padding: 22px;
    }
}

/* GitHub App card ---------------------------------------------------------*/

.github-card {
    display: grid;
    gap: 16px;
    margin-bottom: var(--space-stack);
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(var(--blue-rgb), 0.1), transparent 55%),
        var(--panel);
}

.github-card.is-connected {
    border-color: rgba(var(--teal-rgb), 0.24);
}

.github-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.github-card-mark {
    display: grid;
    flex: none;
    width: 44px;
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.github-card-title {
    min-width: 0;
    flex: 1;
}

.github-card-title .eyebrow {
    margin-bottom: 4px;
    color: var(--blue);
}

.github-card-title h2 {
    margin: 0;
}

.github-status {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 8px;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
}

.github-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
}

.github-status.is-connected {
    border-color: rgba(var(--teal-rgb), 0.35);
    background: rgba(var(--teal-rgb), 0.08);
    color: var(--teal);
}

.github-status.is-connected .github-status-dot {
    background: var(--teal);
    box-shadow: 0 0 10px var(--teal);
}

.github-card-copy {
    max-width: 68ch;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.github-card-copy.is-error {
    color: var(--amber);
}

.github-scopes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.github-scopes li {
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.68rem;
}

.github-scopes .github-scope-mode {
    border-color: rgba(var(--teal-rgb), 0.3);
    color: var(--teal);
}

.github-picker {
    display: grid;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.github-picker-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
}

.github-picker-count {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 400;
}

.github-repo-filter {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font: inherit;
    font-size: 0.82rem;
}

.github-repo-filter[hidden] {
    display: none;
}

.github-repo-filter:focus-visible {
    border-color: rgba(var(--teal-rgb), 0.5);
    outline: none;
}

.github-repo-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.github-repo-list li[hidden] {
    display: none;
}

.github-repo {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.github-repo:hover {
    border-color: rgba(var(--line-rgb), 0.3);
}

.github-repo:has(input:checked) {
    border-color: rgba(var(--teal-rgb), 0.45);
    background: rgba(var(--teal-rgb), 0.07);
}

.github-repo:has(input:disabled) {
    cursor: wait;
    opacity: 0.7;
}

.github-repo input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--teal);
}

.github-repo-name {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.github-repo-name strong {
    overflow: hidden;
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.github-repo-name small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.github-repo-badge {
    padding: 2px 7px;
    border: 1px solid rgba(var(--amber-rgb), 0.3);
    border-radius: 999px;
    color: var(--amber);
    font-family: var(--mono);
    font-size: 0.62rem;
}

.github-repo-skeleton {
    height: 52px;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
    background-size: 200% 100%;
    animation: github-skeleton 1.4s ease-in-out infinite;
}

@keyframes github-skeleton {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

.github-repo-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.github-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
}

.github-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.github-button:hover {
    border-color: rgba(var(--line-rgb), 0.35);
    background: rgba(255, 255, 255, 0.06);
}

.github-button.is-primary {
    border-color: transparent;
    background: var(--teal);
    color: #07110f;
    font-weight: 600;
}

.github-button.is-primary:hover {
    background: #7be3cf;
}

.github-button.is-quiet {
    margin-left: auto;
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.github-button.is-quiet:hover {
    color: var(--amber);
}

.github-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.github-text-link {
    color: var(--muted);
    font-size: 0.8rem;
}

.github-text-link:hover {
    color: var(--text);
}

@media (max-width: 640px) {
    .github-card {
        padding: 18px 16px;
    }

    .github-card-head {
        flex-wrap: wrap;
    }

    /* A basis wide enough that the status pill drops to its own line
       instead of squeezing the heading into a narrow column. */
    .github-card-title {
        flex: 1 1 200px;
        min-width: 0;
    }

    .github-status {
        order: 3;
    }

    .telegram-widget {
        grid-template-columns: 1fr;
    }

    .telegram-widget-mark {
        width: 40px;
        font-size: 1.05rem;
    }

    .panel-copy,
    .telegram-widget-copy p:last-child {
        font-size: 0.9rem;
    }

    .github-button.is-quiet {
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .github-repo-skeleton {
        animation: none;
    }
}

/* Overview layout -----------------------------------------------------------
   One container owns the vertical rhythm, so sections no longer stack their
   own margins (some had none, some doubled up). */

.overview-stack {
    display: grid;
    gap: var(--space-stack);
}

.overview-stack > * {
    margin-block: 0;
}

/* Card hover glow -----------------------------------------------------------
   One quiet effect for cards on every page. It adds a faint inner ring and a
   soft shadow instead of changing border-color, so accented and highlighted
   cards never dim. Slow and slightly delayed, so cards don't flicker while the
   pointer just passes over them. Full-height work areas (chat) are left out:
   the pointer lives there. Pointer devices only: on touch :hover sticks. */

:is(.metric-card, .panel, .telegram-widget, .github-card, .help-step-body, .help-faq article, .help-table-wrap):not(.chat-panel, .chat-sidebar) {
    transition: box-shadow 0.6s ease;
}

@media (hover: hover) {
    :is(.metric-card, .panel, .telegram-widget, .github-card, .help-step-body, .help-faq article, .help-table-wrap):not(.chat-panel, .chat-sidebar):hover {
        box-shadow: var(--glow-hover);
        transition-delay: 0.08s;
    }
}

@media (prefers-reduced-motion: reduce) {
    :is(.metric-card, .panel, .telegram-widget, .github-card, .help-step-body, .help-faq article, .help-table-wrap):not(.chat-panel, .chat-sidebar) {
        transition: none;
    }
}

/* Visually hidden, still read by screen readers. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
