/* ==========================================================================
   Product screen kit: decorative "app window" screens built in HTML/CSS.
   Wrap each screen in an element with aria-hidden="true". Uses tokens from style.css.
   Later tasks append their own .scr-* parts below the base.
   ========================================================================== */

/* ---------- Window ---------- */
.scr {
    max-width: 100%;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-1);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 8px 24px rgba(0, 0, 0, 0.35);
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    text-align: start;
    user-select: none;
    cursor: default;
}

.scr-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 38px;
    padding-inline: 14px;
    border-block-end: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 12px;
}

/* three quiet window dots, solid colors */
.scr-bar::before {
    content: '';
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin-inline-end: 34px;
    border-radius: 50%;
    background: #2a2c30;
    box-shadow: 16px 0 0 #2a2c30, 32px 0 0 #2a2c30;
}

[dir="rtl"] .scr-bar::before {
    box-shadow: -16px 0 0 #2a2c30, -32px 0 0 #2a2c30;
}

.scr-body {
    display: flex;
    min-width: 0;
}

/* ---------- Sidebar ---------- */
.scr-side {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
    width: 216px;
    padding: 12px 8px;
    border-inline-end: 1px solid var(--border);
    background: #0c0d0e;
}

.scr-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 30px;
    padding-inline: 10px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 13px;
    white-space: nowrap;
}

.scr-nav-item i {
    width: 14px;
    color: var(--text-3);
    font-size: 12px;
    text-align: center;
}

.scr-nav-item.is-active {
    background: var(--surface-3);
    color: var(--text);
}

.scr-nav-item.is-active i {
    color: var(--text-2);
}

.scr-main {
    flex: 1;
    min-width: 0;
    padding: 16px;
}

/* ---------- Controls ---------- */
.scr-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding-inline: 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.scr-btn--primary {
    border-color: transparent;
    background: var(--accent-fill);
    color: #fff;
}

.scr-input {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 30px;
    padding-inline: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-3);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
}

.scr-card {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

/* ---------- Status pills ---------- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 20px;
    padding-inline: 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.pill--green { color: var(--green); background: rgba(74, 222, 128, 0.12); }
.pill--amber { color: var(--amber); background: rgba(250, 204, 21, 0.12); }
.pill--red   { color: var(--red);   background: rgba(248, 113, 113, 0.12); }
.pill--blue  { color: var(--accent); background: rgba(76, 141, 255, 0.12); }
.pill--grey  { color: var(--text-2); background: rgba(255, 255, 255, 0.06); }

/* ---------- Toggle ---------- */
.toggle {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 30px;
    height: 18px;
    border-radius: 999px;
    background: var(--surface-3);
    box-shadow: inset 0 0 0 1px var(--border-strong);
    transition: background-color 0.2s ease;
}

.toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-3);
    transition: inset-inline-start 0.2s ease, background-color 0.2s ease;
}

.toggle.is-on {
    background: var(--accent-fill);
    box-shadow: none;
}

.toggle.is-on::after {
    inset-inline-start: 15px;
    background: #fff;
}

/* ---------- Table ---------- */
.scr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.scr-table th {
    padding: 8px 10px;
    border-block-end: 1px solid var(--border);
    color: var(--text-3);
    font-weight: 500;
    text-align: start;
    white-space: nowrap;
}

.scr-table td {
    padding: 10px;
    border-block-end: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-2);
    white-space: nowrap;
}

.scr-table td:first-child {
    color: var(--text);
}

.scr-table tr:last-child td {
    border-block-end: 0;
}

/* ---------- Small shared bits ---------- */
.scr-muted {
    color: var(--text-3);
}

.scr-label,
.scr-group {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 500;
}

.scr-group {
    margin-block: 14px 4px;
    padding-inline: 10px;
}

.scr-label {
    margin-block: 14px 6px;
}

.scr-avatar {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--surface-3);
    box-shadow: inset 0 0 0 1px var(--border-strong);
    color: var(--text-2);
    font-size: 10px;
    font-weight: 600;
}

.scr-avatar--org {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: var(--accent-fill);
    box-shadow: none;
    color: #fff;
}

.scr-avatar--agent {
    background: rgba(76, 141, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(76, 141, 255, 0.28);
    color: var(--accent);
    font-size: 11px;
}

.scr-count {
    margin-inline-start: auto;
    color: var(--text-3);
    font-size: 11px;
}

.scr-btn--block {
    justify-content: center;
    width: 100%;
    height: 30px;
}

.scr-btn--accent {
    border-color: rgba(76, 141, 255, 0.35);
    background: rgba(76, 141, 255, 0.1);
    color: var(--accent);
}

.scr-btn i {
    font-size: 11px;
}

/* workspace switcher + user block (sidebar) */
.scr-ws {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    margin-block-end: 2px;
    padding-inline: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.scr-ws-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scr-ws i,
.scr-select i {
    color: var(--text-3);
    font-size: 9px;
}

.scr-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-block-start: auto;
    padding: 12px 8px 4px;
    border-block-start: 1px solid var(--border);
}

.scr-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 11px;
    white-space: nowrap;
}

.scr-user-name {
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
}

.scr-user-meta i {
    color: var(--green);
    font-size: 10px;
}

/* ---------- Conversation list ---------- */
.scr-convlist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    width: 236px;
    padding: 4px 12px 12px;
    border-inline-end: 1px solid var(--border);
    background: var(--surface-1);
}

.scr-convlist .scr-group {
    margin-block: 8px 0;
    padding-inline: 8px;
}

.scr-convlist .scr-label {
    margin-block: 10px -2px;
}

.scr-select {
    justify-content: space-between;
    color: var(--text);
}

.scr-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.scr-input i {
    font-size: 11px;
}

.scr-conv {
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scr-conv.is-active {
    background: var(--surface-3);
    color: var(--text);
}

/* ---------- Chat ---------- */
.scr-chat {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    background: var(--surface-1);
}

.scr-chat-head {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 50px;
    padding-inline: 20px;
    border-block-end: 1px solid var(--border);
}

.scr-chat-title {
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
}

.scr-chat-share {
    margin-inline-start: auto;
}

.scr-thread {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    padding: 22px 20px;
    overflow: hidden;
}

.scr-msg {
    font-size: 13px;
    line-height: 1.6;
}

.scr-msg--user {
    align-self: flex-end;
    max-width: 78%;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    border-end-end-radius: 4px;
    background: var(--surface-3);
}

.scr-msg--agent {
    display: flex;
    gap: 12px;
    max-width: 560px;
}

.scr-msg-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    color: var(--text);
}

.scr-msg-body ol,
.scr-msg-body ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding-inline-start: 18px;
    color: var(--text);
}

.scr-msg-body ul {
    list-style: disc;
}

.scr-msg-body li::marker {
    color: var(--text-3);
}

/* citation chip [1] */
.scr-cite {
    display: inline-grid;
    place-items: center;
    min-width: 17px;
    height: 17px;
    padding-inline: 4px;
    border-radius: 4px;
    background: rgba(76, 141, 255, 0.14);
    color: var(--accent);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
    vertical-align: 1px;
}

.scr-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-block-start: 2px;
}

.scr-source {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding-inline: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 11.5px;
    white-space: nowrap;
}

.scr-source i {
    color: var(--text-3);
}

.scr-msg-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-block-start: 4px;
}

/* composer */
.scr-composer {
    margin: 0 20px 18px;
    padding: 12px 12px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.scr-composer-input {
    display: block;
    color: var(--text-3);
    font-size: 13px;
}

.scr-composer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-block-start: 14px;
}

.scr-composer-attach {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-2);
    font-size: 11.5px;
    white-space: nowrap;
}

.scr-send {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: var(--accent-fill);
    color: #fff;
    font-size: 11px;
}

/* ---------- Floating panel (modal-like) ---------- */
.scr-panel {
    max-width: 100%;
    padding: 18px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.4);
    color: var(--text);
    font-size: 12px;
    line-height: 1.45;
    text-align: start;
    user-select: none;
    cursor: default;
}

.scr-panel-title {
    font-size: 14px;
    font-weight: 600;
}

.scr-panel-sub {
    margin-block-start: 4px;
    color: var(--text-2);
    font-size: 11.5px;
}

.scr-panel-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-block-start: 16px;
    padding-block-start: 14px;
    border-block-start: 1px solid var(--border);
}

/* choice card with a radio dot */
.scr-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.scr-choice {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 10px;
    padding-inline-start: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    color: var(--text-3);
    font-size: 11px;
}

.scr-choice b {
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
}

.scr-choice::before {
    content: '';
    position: absolute;
    top: 11px;
    inset-inline-start: 10px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1.5px var(--text-3);
}

.scr-choice.is-selected {
    border-color: rgba(76, 141, 255, 0.55);
    background: rgba(76, 141, 255, 0.08);
}

.scr-choice.is-selected::before {
    background: var(--accent);
    box-shadow: inset 0 0 0 3px var(--surface-2);
    outline: 1.5px solid var(--accent);
}

/* chips (segmented choices) */
.scr-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.scr-chip {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding-inline: 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-2);
    font-size: 11.5px;
    white-space: nowrap;
}

.scr-chip.is-selected {
    border-color: rgba(76, 141, 255, 0.55);
    background: rgba(76, 141, 255, 0.1);
    color: var(--text);
}

/* ---------- Screen header + toolbar ---------- */
.scr-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 30px;
}

.scr-head-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.scr-head i.fa-chevron-right {
    font-size: 9px;
}

.scr-head-end {
    margin-inline-start: auto;
}

.scr-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-block: 14px;
    font-size: 12px;
}

.scr-toolbar-end {
    margin-inline-start: auto;
    white-space: nowrap;
}

.scr-toolbar-end b {
    margin-inline-start: 4px;
    font-weight: 600;
    font-feature-settings: 'tnum';
}

.scr-chip i {
    margin-inline-end: 6px;
    color: var(--accent);
    font-size: 9px;
}

/* status dot */
.scr-dot {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-3);
}

.scr-dot--blue  { background: var(--accent); }
.scr-dot--amber { background: var(--amber); }
.scr-dot--green { background: var(--green); }

/* keep digits-with-separators (dates, times) in reading order inside RTL */
.scr-ltr {
    direction: ltr;
    unicode-bidi: isolate;
}

/* ---------- Kanban ---------- */
.scr-kanban {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.scr-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 8px;
    border-radius: var(--radius-md);
    background: var(--bg);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.scr-col-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 4px 6px;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.scr-tcard {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.scr-tcard-top {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    width: 100%;
}

.scr-tcard-top b {
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.scr-tcard-top > span {
    color: var(--text-2);
    font-size: 12px;
    font-feature-settings: 'tnum';
    white-space: nowrap;
}

.scr-tcard-meta {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--text-3);
    font-size: 11px;
    line-height: 1.4;
}

.scr-tcard-meta i {
    font-size: 10px;
}

/* ---------- KPI row ---------- */
.scr-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-block: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.scr-kpi {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 10px 12px;
    font-size: 11.5px;
}

.scr-kpi + .scr-kpi {
    border-inline-start: 1px solid var(--border);
}

.scr-kpi b {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    font-feature-settings: 'tnum';
}

/* ---------- Form controls ---------- */
.scr-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.scr-field > .scr-label {
    margin: 0;
}

.scr-input--filled {
    color: var(--text);
}

.scr-textarea {
    display: block;
    min-height: 92px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    line-height: 1.6;
}

/* label + control on one line (toggles) */
.scr-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 12px;
}

/* bordered list (files, members, integrations) */
.scr-list {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.scr-list-item {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 38px;
    padding-inline: 10px;
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
}

.scr-list-item + .scr-list-item {
    border-block-start: 1px solid var(--border);
}

.scr-list-item i {
    color: var(--text-3);
    font-size: 12px;
}

.scr-list-item .scr-text {
    flex: 1;
    min-width: 0;
}

.scr-list-add {
    color: var(--text-3);
}

/* two-column builder layout */
.scr-builder {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 16px;
    margin-block-start: 16px;
    padding-block-start: 16px;
    border-block-start: 1px solid var(--border);
}

.scr-builder-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

/* ---------- Workflow canvas: nodes joined by edges ---------- */
/* Flex row follows the writing direction, so in RTL the flow runs right to left
   and the chevrons (flipped by the global RTL icon rule) point the same way. */
.scr-flow {
    display: flex;
    align-items: center;
    min-width: 0;
}

.scr-node {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
    padding: 10px 11px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.8);
}

.scr-node b {
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.scr-node-kind {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-block-end: 3px;
    color: var(--text-3);
    font-size: 10.5px;
    font-weight: 500;
}

.scr-node-kind i {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-2);
    font-size: 9px;
}

.scr-node-meta {
    color: var(--text-3);
    font-size: 11px;
    line-height: 1.35;
}

.scr-node--agent .scr-node-kind i  { background: rgba(76, 141, 255, 0.14); color: var(--accent); }
.scr-node--human .scr-node-kind i  { background: rgba(250, 204, 21, 0.12); color: var(--amber); }
.scr-node--action .scr-node-kind i { background: rgba(74, 222, 128, 0.12); color: var(--green); }

.scr-node.is-selected {
    border-color: rgba(76, 141, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(76, 141, 255, 0.14), 0 8px 20px -10px rgba(0, 0, 0, 0.8);
}

.scr-edge {
    position: relative;
    display: flex;
    flex: 0 0 32px;
    align-items: center;
    color: var(--text-2);
}

.scr-edge::before {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-strong);
}

.scr-edge i {
    margin-inline-start: -4px;
    font-size: 8px;
}

/* a small pulse travelling along each edge in reading direction */
.scr-edge::after {
    content: '';
    position: absolute;
    top: calc(50% - 2px);
    inset-inline-start: 0;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0;
    animation: scr-edge-pulse 2.4s ease-in-out infinite;
}

.scr-edge:nth-child(4)::after { animation-delay: 0.6s; }
.scr-edge:nth-child(6)::after { animation-delay: 1.2s; }
.scr-edge:nth-child(8)::after { animation-delay: 1.8s; }

@keyframes scr-edge-pulse {
    0%   { inset-inline-start: 0; opacity: 0; }
    15%  { opacity: 1; }
    60%  { inset-inline-start: calc(100% - 8px); opacity: 1; }
    75%, 100% { inset-inline-start: calc(100% - 8px); opacity: 0; }
}

/* ---------- Meter (progress bar, optional second segment) ---------- */
.scr-meter {
    display: flex;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-3);
}

.scr-meter-fill {
    flex-shrink: 0;
    background: var(--accent-fill);
}

.scr-meter-fill--reserved {
    background: rgba(76, 141, 255, 0.35);
}

.is-visible .scr-meter-fill {
    animation: scr-meter-fill 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes scr-meter-fill {
    from { inline-size: 0; }
}

/* ---------- Activity log: time, actor, action, target ---------- */
.scr-log {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
    margin-block-start: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-size: 12px;
}

.scr-log > * {
    min-width: 0;
    padding: 9px 10px;
    border-block-start: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-2);
    overflow-wrap: anywhere;
}

.scr-log > .scr-log-h {
    border-block-start: 0;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.scr-log-time {
    color: var(--text-3);
    font-feature-settings: 'tnum';
    white-space: nowrap;
}

.scr-log > .scr-log-target {
    overflow: hidden;
    color: var(--text);
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* targets are emails and IDs: truncate at their own end in RTL too */
[dir="rtl"] .scr-log > .scr-log-target {
    direction: ltr;
    text-align: right;
}

@media (max-width: 760px) {
    .scr-flow {
        flex-direction: column;
        align-items: stretch;
    }

    .scr-node {
        flex: none;
    }

    .scr-edge {
        flex: 0 0 22px;
        flex-direction: column;
    }

    .scr-edge::before {
        width: 1px;
        height: auto;
    }

    /* beats the global [dir=rtl] chevron flip so arrows point down in both directions */
    .scr-flow .scr-edge i {
        margin-block-start: -4px;
        margin-inline-start: 0;
        transform: rotate(90deg);
    }

    .scr-edge::after {
        display: none;
    }
}

@media (max-width: 640px) {
    .scr-log {
        grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.25fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .scr-edge::after {
        display: none;
    }
}

/* ---------- Stat tiles: label, big value, small note ---------- */
/* 1px-gap grid: the border-colored background shows through as hairlines when tiles wrap */
.scr-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px;
    margin-block: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--border);
}

.scr-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 10px 12px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 11.5px;
}

.scr-stat b {
    color: var(--text);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
    font-feature-settings: 'tnum';
    white-space: nowrap;
}

.scr-stat b small {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
}

.scr-stat-delta {
    color: var(--green);
}

/* ---------- Bar chart: one span per bar, height via inline --h ---------- */
/* Flex row follows the writing direction, so time runs right to left in RTL. */
.scr-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
    margin-block-start: 12px;
    padding-block-end: 1px;
    border-block-end: 1px solid var(--border);
}

.scr-bars > span {
    flex: 1;
    min-width: 0;
    height: var(--h, 50%);
    border-radius: 3px 3px 0 0;
    background: rgba(76, 141, 255, 0.32);
    transform-origin: bottom;
}

.scr-bars > .is-today {
    background: var(--accent-fill);
}

.is-visible .scr-bars > span {
    animation: scr-bar-grow 1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes scr-bar-grow {
    from { transform: scaleY(0); }
}

.scr-bars-axis {
    display: flex;
    justify-content: space-between;
    margin-block-start: 6px;
    color: var(--text-3);
    font-size: 10.5px;
    font-feature-settings: 'tnum';
}

/* ---------- Project stages (build tracker): done, current with meter, upcoming ---------- */
/* Grid follows the writing direction, so stages run right to left in RTL. */
.scr-stages {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin: 14px 0 0;
    padding: 0;
    overflow: hidden;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--border);
}

.scr-stage {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 10px 12px 12px;
    background: var(--surface-2);
    color: var(--text-3);
    font-size: 11.5px;
}

.scr-stage i {
    margin-block-end: 4px;
    font-size: 13px;
}

.scr-stage b {
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
}

.scr-stage.is-done i { color: var(--green); }
.scr-stage.is-done b { color: var(--text); }

.scr-stage.is-current {
    box-shadow: inset 0 2px 0 var(--accent-fill);
}

.scr-stage.is-current i { color: var(--accent); }
.scr-stage.is-current b { color: var(--text); }
.scr-stage .scr-meter { margin-block: 4px 2px; }

.scr-list-item i.scr-ok {
    color: var(--green);
}

/* list row with an icon tile and a second line */
.scr-list-item--rich {
    height: auto;
    min-height: 50px;
    padding-block: 8px;
}

.scr-list-ico {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    box-shadow: inset 0 0 0 1px var(--border);
}

.scr-list-ico i {
    color: var(--text-2);
    font-size: 14px;
}

.scr-list-item .scr-text small {
    display: block;
    overflow: hidden;
    color: var(--text-3);
    font-size: 11px;
    text-overflow: ellipsis;
}

/* ---------- Narrow viewports: drop secondary columns ---------- */
@media (max-width: 900px) {
    .scr-convlist {
        display: none;
    }
}

@media (max-width: 640px) {
    .scr-side,
    .scr-opt {
        display: none;
    }

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

    .scr-builder {
        grid-template-columns: minmax(0, 1fr);
    }

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

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

    /* three tiles stay on one row rather than leave an empty cell */
    .scr-stats--3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    /* the hidden end-aligned control hands its alignment to the next one */
    .scr-head-end.scr-opt + * {
        margin-inline-start: auto;
    }

    .scr-table th,
    .scr-table td {
        padding-inline: 6px;
    }
}
