/* OmniActa prototype – shared stylesheet
   Sections: tokens · base · shared components · navigation rail · workspace (list + detail) ·
             checklist component · conversation stream · composer · checklist views ·
             teams · type configuration · directory · log · meeting notes · calendar          */

/* ---------------------------------------------------------------
   Tokens
   --------------------------------------------------------------- */
:root {
    color-scheme: light dark;

    --brand-start: #ff7900;
    --brand-end:   #ff0000;
    --brand:       #ff6a00;
    --brand-gradient: linear-gradient(135deg, var(--brand-start), var(--brand-end));

    --bg:        light-dark(#ffffff, #121214);
    --bg-2:      light-dark(#f7f7f8, #19191c);
    --bg-3:      light-dark(#eeeef0, #222226);
    --border:    light-dark(#e6e6ea, #2b2b30);
    --border-2:  light-dark(#d4d4d9, #3a3a40);
    --text:      light-dark(#17171a, #ededf0);
    --text-2:    light-dark(#5f5f66, #a1a1a8);
    --text-3:    light-dark(#9c9ca3, #6a6a72);
    --tint:      light-dark(#fff4ea, #2b1d10);
    --shadow:    light-dark(#0000000f, #00000080);

    --ok:     light-dark(#05ab43, #4ade80);
    --warn:   light-dark(orange, #fbbf24);
    --danger: light-dark(red, #f87171);
    --info:   light-dark(#1d7eff, #60a5fa);
    --subtask: light-dark(#333, #ccc);

    --rail-w: 56px;
    --rail-w-open: 216px;

    --r: 6px;
    --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
    --font-size: 14px/1.45;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------------------------------------------------------------
   Base
   --------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
[hidden], [x-cloak] { display: none !important; }

body {
    font: var(--font-size) var(--font);
    color: var(--text);
    background: var(--bg);
    display: grid;
    grid-template-columns: auto 1fr;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------------------------------------------------------------
   Shared components
   --------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 28px; padding: 0 10px;
    border: 1px solid var(--border-2);
    border-radius: var(--r);
    background: var(--bg);
    font-weight: 500;
    white-space: nowrap;
    &:hover { background: var(--bg-2); }
    &.primary { border-color: transparent; background: var(--brand-gradient); color: #fff; font-weight: 600; }
    /* Solid submit buttons, coloured by the action they perform */
    &.send { border-color: transparent; color: #fff; font-weight: 600; &:hover { filter: brightness(1.08); } }
    &.send.info   { background: var(--info); }
    &.send.ok     { background: var(--ok); }
    &.send.danger { background: var(--danger); }
    &.quiet { border-color: transparent; color: var(--text-2); &:hover { color: var(--text); background: var(--bg-3); } }
    &.sq { width: 28px; padding: 0; justify-content: center; }
    /* Larger buttons with a leading icon (composer actions, primary page actions) */
    &.act { height: 36px; padding: 0 14px 0 10px; gap: 8px; font-size: 1.05em; svg { width: 18px; height: 18px; color: var(--text-2); } }
    &.act[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); svg { color: inherit; } }
    &.act.primary svg { color: #fff; }
    .kbd { margin-left: 2px; }
}

.kbd {
    display: inline-block;
    min-width: 18px; padding: 0 4px;
    border: 1px solid var(--border-2);
    border-radius: 4px;
    font: 11px/16px var(--mono);
    color: var(--text-3);
    text-align: center;
    background: var(--bg);
    &.onlight { color: #fff; border-color: #ffffff66; background: transparent; }
}

.av {
    --s: 22px;
    display: inline-grid; place-items: center;
    width: var(--s); height: var(--s);
    border-radius: 6px;
    font-size: calc(var(--s) * 0.42); font-weight: 600;
    color: #fff; background: var(--c, #777);
    flex: none;
    &.xs { --s: 18px; }
    &.lg { --s: 30px; }
}

/* Overlapping avatars for multiple assignees */
.avs {
    display: inline-flex; align-items: center;
    .av + .av { margin-left: -10px; box-shadow: 0 0 0 1.5px var(--bg); }
    .more { margin-left: 3px; font: 600 10.5px var(--mono); color: var(--text-2); }
}

.status {
    display: inline-flex; align-items: center; gap: 6px;
    font-weight: 500; white-space: nowrap;
    &::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; box-sizing: border-box; }
    &.open::before     { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 35%, transparent); }
    &.waiting::before  { border-color: var(--warn); background: var(--warn); }
    &.resolved::before { border-color: var(--ok); background: var(--ok); }
    &.closed::before   { border-color: var(--text-3); background: var(--text-3); }
}

/* Priority: a text label with a coloured dot. "Normal" is the default and stays silent in lists;
   Urgent and High additionally paint a coloured edge on the row. */
.plabel {
    display: inline-flex; align-items: center; gap: 5px;
    font-weight: 600; white-space: nowrap;
    &::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
    &.urgent { color: var(--danger); }
    &.high   { color: var(--warn); }
    &.normal { color: var(--text-2); font-weight: 500; }
    &.low    { color: var(--text-3); font-weight: 500; }
}

/* Round status icon: Waiting (?) and Completed (✓) */
.sicon {
    display: inline-grid; place-items: center;
    width: 30px; height: 30px; border-radius: 50%;
    font-size: 17px; font-weight: 700; line-height: 1;
    svg { width: 18px; height: 18px; stroke-width: 2.5; }
    &.resolved { color: var(--ok);   background: color-mix(in srgb, var(--ok) 14%, transparent); }
    &.waiting  { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
}

/* Overdue: red capsule with a white timer */
.late {
    display: inline-grid; place-items: center;
    height: 16px; padding: 0 5px; border-radius: 999px;
    background: var(--danger); color: #fff;
    svg { width: 12px; height: 12px; stroke-width: 2.2; }
}

/* Step progress chip */
.prog {
    display: inline-flex; align-items: center; height: 16px; padding: 0 6px; border-radius: 999px;
    font: 600 10.5px/1 var(--mono); color: var(--text-2);
    &.all { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
}

/* References in text: #item, @person, $step */
.ref {
    padding: 0 2px; border-radius: 3px; font-weight: 600;
    &.item   { color: var(--brand); border-bottom: 1.5px solid color-mix(in srgb, var(--brand) 40%, transparent); }
    &.person { color: var(--info);  border-bottom: 1.5px solid color-mix(in srgb, var(--info) 40%, transparent); }
    &.task   { color: var(--subtask); border-bottom: 1.5px solid color-mix(in srgb, var(--subtask) 40%, transparent); .tid { font-family: var(--mono); font-size: .95em; margin-right: 3px; } }
}

.muted { color: var(--text-3); }
.grow { flex: 1; }

/* Generic dropdown menu, appended next to the control that opened it */
.menu-host { position: relative; }
.dd {
    position: absolute; left: 0; top: calc(100% + 4px); z-index: 8;
    min-width: 200px; max-width: 300px; padding: 5px;
    background: var(--bg); border: 1px solid var(--border-2); border-radius: 10px;
    box-shadow: 0 12px 32px #0004;
    text-align: left; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: var(--font-size);
    &.right { left: auto; right: 0; }
    .dh { padding: 4px 8px 6px; font-size: 0.9em; font-weight: 600; text-transform: uppercase; color: var(--text-3); }
    .di {
        display: flex; width: 100%; align-items: center; justify-content: flex-start; gap: 8px;
        padding: 6px 8px; border-radius: var(--r);
        color: var(--text); white-space: nowrap; text-align: left;
        &:hover { background: var(--bg-2); }
        /* Selection indicator sits at the right edge */
        .mark { width: 14px; color: var(--brand); visibility: hidden; flex: none; margin-left: auto; text-align: right; }
        &[aria-checked="true"] .mark { visibility: visible; }
        input[type=checkbox] { margin: 0 0 0 auto; flex: none; width: 16px; height: 16px; cursor: pointer; }
        .grow { flex: 1; min-width: 72px; overflow: hidden; text-overflow: ellipsis; }
        .sub { color: var(--text-3); flex: none; white-space: nowrap; font-size: 0.9em; }
    }
    .dinput {
        padding: 2px 2px 6px;
        input { width: 100%; height: 26px; padding: 0 8px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--bg); font: inherit; color: inherit; outline: 0; &:focus { border-color: var(--brand); } }
    }
    .dempty { padding: 6px 8px; color: var(--text-3); }
    .dlist { max-height: 280px; overflow-y: auto; }
}

.dside .dd { max-width: 240px; }   /* the sidebar clips anything wider */
.rail .dd { left: calc(100% + 6px); top: 0; right: auto; width: 360px; max-width: 360px; }   /* rail popovers open to the right */
.rail.menu-host { overflow: visible; }      /* the rail clips its content; not while a popover is open */

/* Transient feedback message */
.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 10;
    transform: translate(-50%, 8px);
    padding: 8px 14px; border-radius: 8px;
    background: var(--text); color: var(--bg);
    font-weight: 500;
    opacity: 0; pointer-events: none;
    transition: opacity .15s, transform .15s;
    &.show { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------------------------------------------------------------
   Navigation rail (collapsible, CSS-only toggle via #nav-expand)
   --------------------------------------------------------------- */
.rail {
    position: relative; z-index: 3;
    width: var(--rail-w);
    background: var(--bg);
    box-shadow: 1px 0 0 var(--border), 2px 0 12px var(--shadow);
    color: var(--text-2);
    display: flex; flex-direction: column;
    padding: 10px 8px;
    gap: 2px;
    overflow: hidden;
    transition: width .18s ease;

    .mark {
        display: flex; align-items: center; gap: 10px;
        height: 36px; padding: 0 7px; margin-bottom: 10px;
        svg { width: 26px; height: auto; flex: none; }
        .word {
            white-space: nowrap;
            background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
            span { font-weight: 300; } b { font-weight: 500; }
        }
    }

    .item {
        position: relative;
        display: flex; align-items: center; gap: 12px;
        height: 38px; padding: 0 11px;
        border-radius: 8px;
        color: inherit; white-space: nowrap;
        &:hover { background: var(--bg-3); color: var(--text); }
        &[aria-current] {
            color: var(--text); background: var(--tint); font-weight: 600;
            &::before { content: ""; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-gradient); }
        }
        .n {
            position: absolute; top: 5px; left: 24px;
            min-width: 15px; height: 15px; padding: 0 4px;
            border-radius: 999px; background: var(--brand-end); color: #fff;
            font-weight: 700; line-height: 15px; text-align: center;
        }
        &.me .av { border-radius: 50%; margin: 0 -2px; }
    }

    .lbl { opacity: 0; transition: opacity .12s ease; }   /* labels hidden while collapsed */
    .grow { flex: 1; }
    .toggle svg { transition: transform .18s ease; }
}
body:has(#nav-expand:checked) .rail {
    width: var(--rail-w-open);
    .lbl { opacity: 1; transition-delay: .08s; }
    .item .n { position: static; margin-left: auto; }
    .toggle svg { transform: rotate(180deg); }
}

/* ---------------------------------------------------------------
   Workspace: resizable list pane on the left, detail pane on the right
   --------------------------------------------------------------- */
.workspace {
    display: grid;
    grid-template-columns: var(--list-w, 42%) minmax(0, 1fr);   /* --list-w is set by the drag handle */
    min-height: 0;
    min-width: 0;
}

/* ----- List pane ----- */
.list-pane {
    position: relative;
    display: grid; grid-template-rows: auto auto 1fr;   /* bar, filters, list (stretches) */
    min-height: 0; min-width: 0;
    border-right: 1px solid var(--border);
    background: var(--bg);

    /* Drag handle on the right edge; the 2px line lights up on hover and while dragging */
    .splitter {
        position: absolute; top: 0; bottom: 0; right: -4px; width: 8px;
        cursor: col-resize; z-index: 2;
        &::after { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background .12s; }
        &:hover::after, &.active::after { background: var(--brand); }
    }

    .bar {
        display: flex; align-items: center; gap: 8px;
        height: 48px; padding: 0 12px;
        border-bottom: 1px solid var(--border);
        min-width: 0;   /* no overflow clipping: dropdown menus open from this row */

        .view {
            display: inline-flex; align-items: center; gap: 6px;
            height: 30px; padding: 0 8px 0 10px;
            border-radius: var(--r);
            font-size: 1.2em; font-weight: 600;
            &:hover { background: var(--bg-2); }
            .chev { color: var(--text-3); font-size: 0.7em; }
        }
        .count { color: var(--text-3); font-weight: 400; }
        .grow { flex: 1; }

        .find {
            display: inline-flex; align-items: center; gap: 6px;
            height: 28px; flex: 0 1 160px; min-width: 64px; padding: 0 8px;
            border: 1px solid var(--border);
            border-radius: var(--r);
            background: var(--bg-2);
            color: var(--text-3);
            input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; &::placeholder { color: var(--text-3); } }
        }
    }

    .filters {
        display: flex; align-items: center; gap: 6px;
        height: 38px; padding: 0 12px;
        border-bottom: 1px solid var(--border);
        background: var(--bg-2);
        font-size: 0.9em;
        min-width: 0;   /* no overflow clipping: dropdown menus open from this row */
        .f {
            display: inline-flex; align-items: center; gap: 4px;
            height: 24px; padding: 0 8px;
            border: 1px solid var(--border-2);
            border-radius: var(--r);
            background: var(--bg);
            white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis;
            b { font-weight: 600; }
            .x { color: var(--text-3); margin-left: 2px; }
        }
        .add { color: var(--text-2); padding: 0 6px; height: 24px; white-space: nowrap; &:hover { color: var(--text); } }
        .grow { flex: 1; }
    }

    .scroll { overflow: auto; min-height: 0; }
}

/* List table: unread | three-line main cell | state (progress, icon, assignees) */
table.rows {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;

    thead th {
        position: sticky; top: 0; z-index: 1;
        height: 30px;
        padding: 0 8px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        font-size: 0.8em; font-weight: 600; text-transform: uppercase;
        color: var(--text-3);
        text-align: left;
        white-space: nowrap;
        &:first-child { padding-left: 12px; }
        &:last-child { padding-right: 12px; }
    }

    col.c-unread { width: 36px; }
    col.c-main   { width: auto; }
    col.c-state  { width: 150px; }

    th.state, td.state { text-align: right; }
    td.state .cell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
    td.state .asg { margin-left: 4px; }

    tbody tr.t {
        cursor: pointer;
        &:hover td { background: var(--bg-2); }
        &[aria-selected="true"] td { background: var(--tint); }

        /* Priority edge: painted on the first cell so it survives row tinting */
        --p: transparent;
        &.urgent { --p: var(--danger); }
        &.high   { --p: var(--warn); }

        td {
            padding: 10px 4px;
            border-bottom: 1px solid var(--border);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
            vertical-align: middle;
            &:first-child { padding-left: 12px; padding-right: 0; box-shadow: inset 5px 0 0 var(--p); }
            &:last-child { padding-right: 12px; }
        }

        .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--info); }

        .main {
            display: grid;
            > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
            .l1 { font-weight: 600; .org { font-weight: 400; color: var(--text-3); margin-left: 6px; } }
            .l2 { display: flex; align-items: center; gap: 8px; font-size: 0.9em; color: var(--text-2); }
            .l3 { font-size: var(--font-size); color: var(--text); }
        }
        &.unread .main .l3 { font-weight: 600; }

        .none { color: var(--text-3); font-size: 0.8em; border: 1px dashed var(--border-2); border-radius: 6px; width: 22px; height: 22px; display: inline-grid; place-items: center; }
    }
}

/* ----- Detail pane ----- */
.detail {
    display: grid;
    grid-template-columns: 1fr 272px;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "bar  bar"
        "main side";
    min-height: 0; min-width: 0;
    background: var(--bg);

    .dbar {
        grid-area: bar;
        display: flex; align-items: center; gap: 6px;
        height: 48px; padding: 0 16px;
        border-bottom: 1px solid var(--border);
        min-width: 0;
        .title { margin: 0 4px 0 0; min-width: 0; font-size: 1.5em; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .title input { width: 100%; font: inherit; color: inherit; border: 0; outline: 0; background: transparent; }
        .id { font: 12px var(--mono); color: var(--text-3); flex: none; }
        .copy { color: var(--text-3); flex: none; &:hover { color: var(--text); } }
        .grow { flex: 1; }
    }

    .dmain {
        grid-area: main;
        display: grid; grid-template-rows: 1fr auto;
        min-height: 0; min-width: 0;
    }

    /* View configuration (top bar): icon button with a dropdown of display toggles */
    .view-config {
        position: relative; flex: none;
        .menu {
            position: absolute; right: 0; top: calc(100% + 6px); z-index: 5;
            min-width: 220px; padding: 6px;
            background: var(--bg);
            border: 1px solid var(--border-2); border-radius: 10px;
            box-shadow: 0 12px 32px #0004;
            .mh { padding: 4px 8px 6px; font-size: 0.9em; font-weight: 600; text-transform: uppercase; color: var(--text-3); }
            label {
                display: flex; align-items: center; gap: 8px;
                padding: 6px 8px; border-radius: var(--r);
                cursor: pointer;
                &:hover { background: var(--bg-2); }
                input { margin: 0; }
            }
        }
        .btn[aria-expanded="true"] { background: var(--bg-3); color: var(--text); }
    }

    .thread {
        overflow-y: auto; padding: 18px 20px 24px;
        > .type { font-size: 0.9em; font-weight: 600; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
        &.hide-events .event { display: none; }
        &.hide-internal .msg.internal { display: none; }
    }

    /* Content blocks in the scrolling main column */
    .block {
        & + .block { margin-top: 22px; }
        > h3 {
            margin: 0 0 8px; display: flex; align-items: center; gap: 8px;
            font-size: 0.9em; font-weight: 600; text-transform: uppercase; color: var(--text-3);
            .grow { flex: 1; }
            .btn { height: 24px; padding: 0 8px; font-size: 0.95em; font-weight: 500; letter-spacing: 0; text-transform: none; }
        }
    }
    .bar { width: 120px; height: 4px; border-radius: 2px; background: var(--bg-3); overflow: hidden; i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .2s; } }

    /* Field panel (type-specific ticket fields, checklist and template properties) */
    .tfields {
        display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; align-items: center;
        margin: 0; padding: 10px 14px;
        border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2);
        dt { font-size: 0.9em; color: var(--text-2); }
        dd { margin: 0; min-width: 0; }
        .fv {
            display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
            min-height: 26px; padding: 0 7px; margin-left: -7px;
            border: 1px solid transparent; border-radius: var(--r);
            font-size: 0.9em; text-align: left;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
            /* Editable values read as light inputs on the tinted panel and span the whole column */
            &:is(button) { display: flex; width: calc(100% + 7px); background: color-mix(in srgb, var(--text) 3%, transparent); }
            &:is(button):hover { background: var(--bg); border-color: var(--border-2); }
            &.link { color: var(--info); text-decoration: underline; text-underline-offset: 2px; }
            &.overdue { color: var(--danger); font-weight: 600; }
            &.wrap { white-space: normal; }
            input { flex: 1; min-width: 0; width: 100%; font: inherit; color: inherit; border: 0; outline: 0; background: transparent; }
            input[type=checkbox] { flex: none; width: 14px; height: 14px; margin: 0; pointer-events: none; }
        }
    }

    /* Right sidebar */
    .dside {
        grid-area: side;
        overflow-y: auto;
        border-left: 1px solid var(--border);
        background: var(--bg-2);
        padding: 14px 16px 24px;

        h3 {
            margin: 0 0 8px;
            font-size: 0.8em; font-weight: 600; text-transform: uppercase;
            color: var(--text-3);
            display: flex; align-items: center; justify-content: space-between;
            .btn { height: 22px; padding: 0 6px; font-weight: 500; text-transform: none; }
        }
        section + section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

        .fields {
            display: grid; grid-template-columns: 84px 1fr; gap: 4px 8px; align-items: center;
            margin: 0;
            dt { font-size: 0.9em; color: var(--text-2); margin: 0; }
            dd { margin: 0; min-width: 0; }
        }

        /* Each value looks like an inline control: hover reveals the editable affordance */
        .val {
            display: flex; align-items: center; gap: 6px;
            width: 100%; min-height: 28px; padding: 0 7px;
            border: 1px solid transparent;
            border-radius: var(--r);
            font-size: 0.9em; text-align: left;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
            &:is(button) { background: color-mix(in srgb, var(--text) 3%, transparent); }
            &:is(button):hover { background: var(--bg); border-color: var(--border-2); }
            &::after { content: "▾"; margin-left: auto; color: var(--text-3); font-size: 1.5em; line-height: 1; padding-bottom: 4px; opacity: 0; }
            &:hover::after { opacity: 1; }
            &.plain::after { content: none; }
            .muted { font-weight: 400; }
            input { width: 100%; font: inherit; color: inherit; border: 0; outline: 0; background: transparent; }
        }

        .tags { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0; }
        .tag {
            display: inline-flex; align-items: center; gap: 4px;
            height: 22px; padding: 0 8px;
            border: 1px solid var(--border-2); border-radius: 999px;
            background: var(--bg); font-size: 0.9em;
            &.add { color: var(--text-3); border-style: dashed; background: transparent; }
            .x { margin: 0 -3px 0 1px; padding: 0 3px; color: var(--text-3); cursor: pointer; font-size: 1.1em; line-height: 1; &:hover { color: var(--danger); } }
        }

        /* Notification channels */
        .chans {
            display: flex; flex-wrap: wrap; gap: 4px 10px; min-height: 28px; align-items: center;
            font-size: 0.9em; color: var(--text-2);
            label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
            input { margin: 0; }
            &.off { opacity: .45; pointer-events: none; }
        }

        .watchers {
            display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
            .add { width: 22px; height: 22px; border: 1px dashed var(--border-2); border-radius: 6px; color: var(--text-3); display: grid; place-items: center; }
            .w {
                position: relative; display: inline-grid;
                .x { position: absolute; top: -5px; right: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 0.9em; line-height: 14px; text-align: center; opacity: 0; cursor: pointer; }
                &:hover .x { opacity: 1; }
            }
        }
        .fine { color: var(--text-3); margin-top: 8px; }
    }
}

/* ---------------------------------------------------------------
   Checklist component (ticket subtasks and standalone checklists)
   --------------------------------------------------------------- */
.subtasks {
    list-style: none; margin: 0; padding: 0;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg);

    .st {
        position: relative;
        display: grid; grid-template-columns: 18px 30px 1fr auto auto 26px; align-items: center; gap: 10px;
        min-height: 38px; padding: 4px 8px 4px 12px;
        & + .st { border-top: 1px solid var(--border); }
        &:first-child { border-radius: 10px 10px 0 0; }
        &:last-child  { border-radius: 0 0 10px 10px; }
        &:hover, &:has(.st-more[aria-expanded="true"]) { background: var(--bg-2); }
        .st-cb { width: 16px; height: 16px; margin: 0; cursor: pointer; }
        .st-id { font: 600 11.5px var(--mono); color: var(--subtask); cursor: grab; }   /* the number is the drag handle */
        &.dragging { opacity: .4; }
        &.drop-before { box-shadow: inset 0 2px 0 var(--brand); }
        &.drop-after  { box-shadow: inset 0 -2px 0 var(--brand); }
        .st-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; input { width: 100%; font: inherit; color: inherit; border: 0; outline: 0; background: transparent; } }
        &.st-done .st-title { color: var(--text-3); text-decoration: line-through; }
        &.st-done .st-id { opacity: .6; }

        /* Skipped: not counted, visually parked */
        &.st-skipped .st-title { color: var(--text-3); font-style: italic; }
        &.st-skipped .st-id { opacity: .6; }
        &.st-skipped .st-cb { opacity: .35; }
        .skip-tag { font-size: 0.8em; font-weight: 600; text-transform: uppercase; color: var(--text-3); margin-left: 6px; }

        /* Start and due dates are read-only here; the ⋯ menu sets or removes them */
        .st-dates {
            display: inline-flex; align-items: center; gap: 4px;
            font-size: 0.9em; color: var(--text-2); white-space: nowrap;
            svg { width: 13px; height: 13px; color: var(--text-3); }
            .arr { color: var(--text-3); }
            &.overdue { color: var(--danger); font-weight: 600; }
            input { font: inherit; color: inherit; border: 0; outline: 0; background: transparent; }
        }
    }

    /* Controls shared by rows and section headers */
    .st-asg, .st-more {
        display: inline-flex; align-items: center; justify-content: center; gap: 4px;
        height: 24px; min-width: 24px; padding: 0 5px; border-radius: var(--r);
        font-size: 0.9em; color: var(--text-2); white-space: nowrap;
        &:hover, &[aria-expanded="true"] { background: var(--bg); border-color: var(--border-2); color: var(--text); }
        .ghost { color: var(--text-3); font-size: 1.3em; font-weight: bold; line-height: 1; }
        .inherit { opacity: .5; display: inline-flex; }   /* parent's assignees shown as the implicit owners */
        svg { width: 15px; height: 15px; }
    }
    .st-more { font-size: 1.3em; font-weight: bold; line-height: 1; }

    /* Row and section menus */
    .st-menu {
        position: absolute; right: 8px; top: calc(100% - 4px); z-index: 6;
        min-width: 190px; padding: 5px;
        background: var(--bg); border: 1px solid var(--border-2); border-radius: 10px;
        box-shadow: 0 12px 32px #0004;
        text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); font-size: var(--font-size);
        button {
            display: flex; width: 100%; align-items: center; gap: 8px;
            padding: 6px 9px; border-radius: var(--r);
            text-align: left;
            &:hover { background: var(--bg-2); }
            &.danger { color: var(--danger); }
        }
        hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }
    }

    .empty { padding: 10px 12px; font-size: 0.9em; }

    /* Section header: names the template a run of steps came from and carries section-wide actions */
    .st-group {
        position: relative;
        display: grid; grid-template-columns: 1fr auto 26px; align-items: center; gap: 10px;
        min-height: 32px; padding: 2px 8px 2px 12px;
        background: var(--bg-2);
        border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
        font-size: 0.8em; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3);
        &:first-child { border-top: 0; border-radius: 10px 10px 0 0; }
        &.drop-after { box-shadow: inset 0 -2px 0 var(--brand); }   /* drop target: start of this section */
        .st-asg, .st-more { font-size: 1.15em; letter-spacing: 0; text-transform: none; font-weight: 500; }
        .st-more { font-size: 1.6em; font-weight: bold; }
        .sg-count { font-size: 1.25em; color: var(--text-3); }
    }
    .st-group + .st { border-top: 0; }

}
.st-add {
    display: flex; align-items: center; gap: 10px; padding: 6px 0 6px 12px; margin: 4px 0 0;
    .plus { width: 18px; text-align: center; color: var(--text-3); }
    input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; &::placeholder { color: var(--text-3); } }
    .btn { margin-left: auto; height: 34px; padding: 0 14px 0 10px; gap: 8px; font-size: 1.05em; font-weight: 500; svg { width: 18px; height: 18px; color: var(--text-2); } }
}

/* ---------------------------------------------------------------
   Conversation / activity stream
   --------------------------------------------------------------- */
.stream {
    margin: 0; padding: 0; list-style: none;
    display: grid; gap: 14px;

    .msg {
        display: grid; grid-template-columns: 30px 1fr; gap: 12px;
        .bubble {
            border: 1px solid var(--border);
            border-radius: 10px;
            background: var(--bg);
            overflow: hidden;
            .head {
                display: flex; align-items: center; gap: 8px;
                padding: 8px 12px;
                background: var(--bg-2);
                border-bottom: 1px solid var(--border);
                font-size: 0.9em; color: var(--text-2);
                b { color: var(--text); font-weight: 600; }
                .role { padding: 0 6px; border-radius: 4px; background: var(--bg-3); font-size: 0.8em; }
                .grow { flex: 1; }
                .edited { color: var(--text-3); }
            }
            .body { padding: 12px 14px; font-size: var(--font-size); line-height: 1.6; p { margin: 0 0 8px; &:last-child { margin: 0; } } ul { margin: 0 0 8px; padding-left: 18px; } }
        }
        &.internal .bubble { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); .head { background: color-mix(in srgb, var(--warn) 10%, var(--bg-2)); } }
        &.requester .bubble { border-left: 3px solid var(--info); }
    }

    /* Events are monochrome; the empty icon slot only keeps the alignment with bubbles */
    .event {
        display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: center;
        color: var(--text-2); font-size: 0.9em;
        .ic { width: 30px; height: 30px; display: grid; place-items: center; color: var(--text-3); }
        b { color: var(--text); font-weight: 600; }
        .when { color: var(--text-3); margin-left: 6px; }
        .chg {
            display: inline-flex; align-items: center; gap: 4px;
            margin: 0 2px;
            font-family: var(--mono); font-size: 0.9em;
            .o { color: var(--text-3); text-decoration: line-through; }
            .a { color: var(--text-3); }
            .n { color: var(--text); font-weight: 600; }
        }
        .ref, .ref.item, .ref.person, .ref.task { color: var(--text); border-bottom-color: var(--border-2); }
    }

    .divider {
        display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
        color: var(--text-3); font-size: 0.8em; text-transform: uppercase;
        &::before, &::after { content: ""; height: 1px; background: var(--border); }
        &.new { color: var(--brand); &::before, &::after { background: color-mix(in srgb, var(--brand) 40%, transparent); } }
    }
}

/* ---------------------------------------------------------------
   Composer pinned to the bottom of the detail pane
   --------------------------------------------------------------- */
.composer {
    border-top: 1px solid var(--border);
    background: var(--bg-2);
    padding: 10px 20px 12px;
    position: relative;

    .actions { display: flex; flex-wrap: wrap; gap: 8px; }

    /* The form unfolds (0fr → 1fr); the composer is pinned to the bottom, so it grows upwards */
    .form {
        display: grid; grid-template-rows: 0fr;
        transition: grid-template-rows .24s ease;
        .form-inner { overflow: hidden; min-height: 0; padding: 0 4px; margin: 0 -4px; }
        .form-head {
            display: flex; align-items: center; gap: 8px;
            padding: 10px 0 6px;
            font-size: 0.9em; color: var(--text-3);
            .mode-label { font-weight: 600; color: var(--text); }
            .grow { flex: 1; }
        }
    }
    &.open .form { grid-template-rows: 1fr; }
    &.open .form .form-inner { padding-bottom: 4px; }

    .box {
        border: 1px solid var(--border-2);
        border-radius: 10px;
        background: var(--bg);
        &:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
        textarea {
            display: block; width: 100%; min-height: 72px; max-height: 40vh;
            resize: none; border: 0; outline: 0; background: transparent; padding: 10px 12px;
            overflow-x: hidden; overflow-y: auto;
            white-space: pre-wrap; overflow-wrap: anywhere;
            line-height: 1.5;
        }
        .tools {
            display: flex; align-items: center; gap: 4px;
            padding: 6px 8px;
            border-top: 1px solid var(--border);
            .grow { flex: 1; }
            .hint { color: var(--text-3); font-size: 0.9em; margin-right: 6px; }
        }
    }
    &[data-mode="internal"] .box {
        border-color: color-mix(in srgb, var(--warn) 50%, var(--border-2));
        background: color-mix(in srgb, var(--warn) 6%, var(--bg));
    }

    /* Autocomplete for # items, @ people, $ steps */
    .pop {
        position: absolute; left: 36px; bottom: calc(100% - 4px);
        width: 320px;
        background: var(--bg);
        border: 1px solid var(--border-2);
        border-radius: 10px;
        box-shadow: 0 12px 32px #0004;
        overflow: hidden;
        .ph { padding: 6px 10px; font-size: 0.8em; color: var(--text-3); text-transform: uppercase; background: var(--bg-2); border-bottom: 1px solid var(--border); }
        .row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 0.9em; .t { font-family: var(--mono); color: var(--brand); font-size: 0.9em; } .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .k { color: var(--text-3); font-size: 0.8em; } &[aria-selected="true"] { background: var(--tint); } }
    }
}

/* ---------------------------------------------------------------
   Checklist views (checklists.html)
   --------------------------------------------------------------- */
.detail .hero {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-bottom: 18px;
    .meta { color: var(--text-2); font-size: 0.9em; display: inline-flex; align-items: center; gap: 6px; .sep { color: var(--text-3); } }
    .grow { flex: 1; }
}
.detail .desc {
    margin: 0 0 18px; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2);
    color: var(--text-2); font-size: 0.95em; line-height: 1.5;
    &.empty { color: var(--text-3); font-style: italic; }
    &:hover { border-color: var(--border-2); }
    textarea { width: 100%; min-height: 60px; resize: vertical; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); }
}
.usage {
    list-style: none; margin: 0; padding: 0;
    li { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 0.9em; .k { margin-left: auto; color: var(--text-3); font-size: 0.85em; white-space: nowrap; } }
}
/* Small label chip, e.g. "Default for Hardware problem" */
.chip {
    display: inline-flex; align-items: center; gap: 4px;
    height: 20px; padding: 0 8px; border-radius: 999px;
    font-size: 0.85em; font-weight: 600;
    color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent);
    &.plain { color: var(--text-2); background: var(--bg-3); font-weight: 500; }
}
/* Template steps: number | title | default assignee | ⋯ */
.subtasks.plain .st { grid-template-columns: 30px 1fr auto 26px; }
/* Drop indicator for dropping at the very end of a list */
.subtasks.drop-end { box-shadow: inset 0 -2px 0 var(--brand); }


/* ---------------------------------------------------------------
   Teams (groups and departments) as assignees
   --------------------------------------------------------------- */
.av.team { border-radius: 50%; svg { width: 62%; height: 62%; stroke-width: 2; } }
.dd .dh.sect { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.ref.team { color: #7a5cff; border-bottom: 1.5px solid color-mix(in srgb, #7a5cff 40%, transparent); }

/* Small coloured kind label used by several views (calendar kinds, type kinds) */
.kbadge {
    display: inline-flex; align-items: center; gap: 6px;
    height: 22px; padding: 0 9px; border-radius: 999px;
    font-size: 0.85em; font-weight: 600;
    color: var(--k, var(--text-2)); background: color-mix(in srgb, var(--k, var(--text-3)) 14%, transparent);
    svg { width: 13px; height: 13px; }
}
.hero .btn.act { height: 32px; font-size: 1em; }
.detail .thread .lead { margin: 0 0 16px; color: var(--text-2); line-height: 1.55; }
.detail .thread .empty-state { padding: 40px 0; text-align: center; color: var(--text-3); }

/* Key/value rows inside a block (read-mostly information) */
.kv {
    display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; align-items: baseline;
    margin: 0; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2);
    dt { font-size: 0.9em; color: var(--text-2); }
    dd { margin: 0; min-width: 0; }
}

/* List of linked things (checklists of a type, related objects, tickets) */
.linked {
    list-style: none; margin: 0; padding: 0;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
    li {
        display: flex; align-items: center; gap: 10px;
        min-height: 40px; padding: 6px 10px 6px 12px;
        & + li { border-top: 1px solid var(--border); }
        &:hover { background: var(--bg-2); }
        .ic { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--bg-3); color: var(--text-2); flex: none; svg { width: 15px; height: 15px; } }
        .l { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; b { font-weight: 600; } .sub { color: var(--text-3); margin-left: 8px; font-size: 0.9em; } }
        .k { color: var(--text-3); font-size: 0.85em; white-space: nowrap; }
        .x { color: var(--text-3); padding: 0 4px; font-size: 1.2em; line-height: 1; cursor: pointer; opacity: 0; &:hover { color: var(--danger); } }
        &:hover .x { opacity: 1; }
        a.l { color: inherit; &:hover b { color: var(--brand); } }
    }
    .empty { color: var(--text-3); font-size: 0.9em; }
}
.linked-add { display: flex; gap: 8px; align-items: center; padding: 8px 0 0 2px; }

/* ---------------------------------------------------------------
   Type configuration (types.html): field editor
   --------------------------------------------------------------- */
.fed-list {
    list-style: none; margin: 0; padding: 0;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
    &.drop-end { box-shadow: inset 0 -2px 0 var(--brand); }
    .fed {
        position: relative;
        display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto 26px; align-items: center; gap: 10px;
        min-height: 42px; padding: 4px 8px 4px 10px;
        cursor: pointer;
        & + .fed { border-top: 1px solid var(--border); }
        &:first-child { border-radius: 10px 10px 0 0; }
        &:last-child  { border-radius: 0 0 10px 10px; }
        &:hover, &[aria-expanded="true"], &:has(.st-more[aria-expanded="true"]) { background: var(--bg-2); }
        &.dragging { opacity: .4; }
        &.drop-before { box-shadow: inset 0 2px 0 var(--brand); }
        .handle { color: var(--text-3); cursor: grab; text-align: center; font-size: 1.1em; letter-spacing: -2px; user-select: none; }
        &.builtin .handle { visibility: hidden; }
        .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; b { font-weight: 600; } .key { font: 11.5px var(--mono); color: var(--text-3); margin-left: 8px; } .help { color: var(--text-3); margin-left: 8px; font-size: 0.9em; } }
        .flags { display: flex; gap: 4px; .chip { height: 18px; font-size: 0.8em; } }
        .st-more { align-self: center; }
    }
    /* Expanded editor for one field */
    .fed-form {
        grid-column: 1 / -1;
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px;
        padding: 4px 4px 12px 30px; cursor: default;
        label { display: grid; gap: 4px; font-size: 0.85em; color: var(--text-2); min-width: 0; }
        input[type=text], input[type=number], input[type=date], input[type=time], select, textarea {
            height: 30px; padding: 0 8px; min-width: 0;
            border: 1px solid var(--border-2); border-radius: var(--r);
            background: var(--bg); color: var(--text); font: inherit; outline: 0;
            &:focus { border-color: var(--brand); }
            &:disabled { color: var(--text-3); background: var(--bg-2); }
        }
        textarea { height: auto; min-height: 64px; padding: 6px 8px; resize: vertical; font-family: var(--mono); font-size: 0.95em; }
        .check { grid-template-columns: auto 1fr; align-items: center; input { margin: 0; } }
        .span2 { grid-column: 1 / -1; }
        .frow { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; .grow { flex: 1; } .fine { margin: 0; } }
    }
}
/* Preview of the field panel as it appears in a ticket or object */
.tfields .prow { display: contents; }
.tfields .req { color: var(--danger); margin-left: 2px; }
.tfields .fv.placeholder { color: var(--text-3); font-style: italic; }
.tfields .help { font-size: 0.8em; color: var(--text-3); margin-left: 6px; font-weight: 400; }

/* ---------------------------------------------------------------
   Directory (objects.html)
   --------------------------------------------------------------- */
.oicon {
    display: inline-grid; place-items: center;
    width: 24px; height: 24px; border-radius: 6px;
    background: color-mix(in srgb, var(--c, var(--text-3)) 16%, transparent); color: var(--c, var(--text-2));
    svg { width: 15px; height: 15px; }
    &.lg { width: 34px; height: 34px; border-radius: 9px; svg { width: 20px; height: 20px; } }
}
table.rows td.icon { width: 36px; padding-right: 0; }
.detail .tfields .fv .avs { margin-right: 2px; }
.detail .tfields .fv .ref { font-weight: 500; }
.detail .tfields .fv .ref + .ref { margin-left: 4px; }
.pill {
    display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px;
    font-size: 0.85em; font-weight: 600; white-space: nowrap;
    color: var(--text-2); background: var(--bg-3);
    &::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
    &.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
    &.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
    &.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
    &.info { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }
}
/* Change history: same look as the ticket event stream, slightly tighter */
.history { gap: 10px; .event .ic::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--border-2); } }
.showmore { margin-top: 8px; color: var(--text-2); font-size: 0.9em; &:hover { color: var(--text); } }

/* ---------------------------------------------------------------
   Log (log.html)
   --------------------------------------------------------------- */
table.rows tr.day td {
    padding: 12px 12px 4px; background: var(--bg);
    font-size: 0.8em; font-weight: 600; text-transform: uppercase; color: var(--text-3);
    border-bottom: 0; cursor: default;
    .n { font-weight: 400; margin-left: 6px; }
}
table.rows tbody tr.t .main .l1.text { font-weight: 500; .ref { font-weight: 600; } }
/* Composer that is always open (no action row) */
.composer.static { .form { grid-template-rows: 1fr; } .form-head { padding-top: 0; } }
.composer .tools .pick { height: 26px; padding: 0 8px; font-size: 0.9em; color: var(--text-2); gap: 5px; svg { width: 14px; height: 14px; } .av { --s: 16px; } }
.entry {
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg); overflow: hidden;
    .head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-2); border-bottom: 1px solid var(--border); font-size: 0.9em; color: var(--text-2); b { color: var(--text); font-weight: 600; } .grow { flex: 1; } .btn { height: 24px; } }
    .body { padding: 12px 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
    .body textarea { width: 100%; min-height: 90px; resize: vertical; border: 0; outline: 0; background: transparent; font: inherit; color: inherit; line-height: 1.6; }
    .foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 0.9em; color: var(--text-3); }
}

/* ---------------------------------------------------------------
   Meeting notes (meetings.html)
   --------------------------------------------------------------- */
.agenda {
    margin: 0; padding: 0; list-style: none; counter-reset: ag;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
    li {
        display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 4px 8px 4px 12px;
        & + li { border-top: 1px solid var(--border); }
        &::before { counter-increment: ag; content: counter(ag); width: 18px; font: 600 11.5px var(--mono); color: var(--text-3); }
        .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; input { width: 100%; font: inherit; color: inherit; border: 0; outline: 0; background: transparent; } }
        .x { color: var(--text-3); padding: 0 4px; font-size: 1.2em; line-height: 1; opacity: 0; cursor: pointer; &:hover { color: var(--danger); } }
        &:hover .x { opacity: 1; }
        &.empty { color: var(--text-3); font-size: 0.9em; &::before { content: none; } }
    }
    &.decisions li::before { content: "✓"; color: var(--ok); font-size: 1em; }
}
.notes {
    margin: 0; padding: 12px 14px; min-height: 60px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
    line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
    cursor: text;
    &.empty { color: var(--text-3); font-style: italic; }
    &:hover { border-color: var(--border-2); }
    textarea { width: 100%; min-height: 120px; resize: vertical; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); line-height: 1.6; }
}
/* Action items: checkbox | title | assignee | due | ticket | ⋯ */
.subtasks.actions .st { grid-template-columns: 18px 1fr auto auto auto 26px; }
.subtasks.actions .st .st-dates { cursor: pointer; border-radius: var(--r); padding: 2px 5px; &:hover { background: var(--bg); } .ghost { color: var(--text-3); } }
.attendees { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* Autocomplete list below a notes field (same look as the composer's) */
.notes-wrap { position: relative; }
.notes-wrap .pop {
    position: absolute; left: 12px; top: calc(100% + 4px); z-index: 6;
    width: 320px;
    background: var(--bg); border: 1px solid var(--border-2); border-radius: 10px;
    box-shadow: 0 12px 32px #0004; overflow: hidden;
    .ph { padding: 6px 10px; font-size: 0.8em; color: var(--text-3); text-transform: uppercase; background: var(--bg-2); border-bottom: 1px solid var(--border); }
    .row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 0.9em; .t { font-family: var(--mono); color: var(--brand); font-size: 0.9em; } .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .k { color: var(--text-3); font-size: 0.8em; } &[aria-selected="true"] { background: var(--tint); } }
}
.row-when { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); svg { width: 14px; height: 14px; color: var(--text-3); } }

/* ---------------------------------------------------------------
   Calendar (calendar.html)
   --------------------------------------------------------------- */
.workspace.cal-ws { --list-w: 60%; }
.cal { display: grid; grid-template-rows: auto 1fr; height: 100%; min-height: 0; }
.cal-head {
    display: grid; grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border); background: var(--bg);
    span { padding: 6px 8px; font-size: 0.8em; font-weight: 600; text-transform: uppercase; color: var(--text-3); }
}
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(104px, 1fr); min-height: 0; }
.cal-day {
    position: relative; min-width: 0;
    display: flex; flex-direction: column; gap: 2px;
    padding: 4px 6px 6px;
    border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
    cursor: pointer; overflow: hidden;
    &:nth-child(7n) { border-right: 0; }
    &:hover { background: var(--bg-2); }
    &.other { background: color-mix(in srgb, var(--bg-2) 70%, var(--bg)); .num { color: var(--text-3); } }
    &.weekend:not(.other) { background: color-mix(in srgb, var(--bg-2) 50%, var(--bg)); }
    &[aria-selected="true"] { background: var(--tint); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 40%, transparent); }
    .num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; margin-bottom: 2px; font-size: 0.85em; font-weight: 600; color: var(--text-2); }
    &.today .num { background: var(--brand-gradient); color: #fff; }
    .more { font-size: 0.8em; color: var(--text-3); padding-left: 6px; }
}
/* One calendar entry, coloured by kind via --k */
.ev {
    display: flex; align-items: center; gap: 5px;
    width: 100%; height: 20px; padding: 0 6px 0 5px; border-radius: 4px;
    border-left: 3px solid var(--k); color: var(--k); background: color-mix(in srgb, var(--k) 13%, transparent);
    font-size: 0.8em; font-weight: 500; white-space: nowrap; overflow: hidden; text-align: left;
    .t { font-family: var(--mono); font-size: 0.95em; opacity: .85; flex: none; }
    .l { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
    svg { width: 12px; height: 12px; flex: none; }
    &[aria-selected="true"] { background: var(--k); color: #fff; }
    &.done { opacity: .55; .l { text-decoration: line-through; } }
    &.lg { height: 34px; font-size: 0.95em; gap: 8px; padding: 0 10px 0 8px; border-radius: 6px; .t { min-width: 44px; } svg { width: 14px; height: 14px; } }
}
.k-meeting     { --k: var(--info); }
.k-ticket      { --k: var(--brand); }
.k-outage      { --k: var(--danger); }
.k-appointment { --k: #b65cff; }
.k-repeat      { --k: var(--ok); }
.filters .f.kind {
    cursor: pointer; gap: 6px; user-select: none;
    i { width: 8px; height: 8px; border-radius: 50%; background: var(--k); }
    &[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
}
.agenda-list { display: grid; gap: 4px; }
.agenda-list .ev .k { margin-left: auto; opacity: .75; font-weight: 400; }
.cal-nav { display: inline-flex; align-items: center; gap: 2px; .btn.sq { font-size: 1.1em; } }
.detail .thread .when-hero { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; .big { font-size: 1.3em; font-weight: 650; } .rel { color: var(--text-3); } }
/* Occurrence timeline of a repeating task */
.occ {
    list-style: none; margin: 0; padding: 0;
    border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
    li { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 4px 12px; font-size: 0.95em; & + li { border-top: 1px solid var(--border); } .d { min-width: 90px; font-weight: 600; } .k { margin-left: auto; color: var(--text-3); font-size: 0.9em; white-space: nowrap; } }
    li.next { background: var(--tint); .d { color: var(--brand); } }
}
/* Agenda rows (list view) share the ticket table; the day column is wider */
table.rows col.c-day { width: 110px; }
table.rows td.day { color: var(--text-2); font-size: 0.9em; white-space: nowrap; b { color: var(--text); font-weight: 600; display: block; } }


/* ---------------------------------------------------------------
   Attachments (composer and messages)
   --------------------------------------------------------------- */
.atts { display: flex; flex-wrap: wrap; gap: 6px; }
.stream .body .atts { margin-top: 8px; }
.att {
    display: inline-flex; align-items: center; gap: 6px;
    height: 26px; padding: 0 9px 0 7px; border-radius: 999px;
    border: 1px solid var(--border-2); background: var(--bg-2); font-size: 0.85em; color: var(--text);
    svg { width: 13px; height: 13px; color: var(--text-3); }
    .n { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .s { color: var(--text-3); }
    .x { color: var(--text-3); cursor: pointer; margin: 0 -3px 0 2px; font-size: 1.1em; line-height: 1; &:hover { color: var(--danger); } }
    &:hover { border-color: var(--text-3); }
}
.composer .pending { padding: 0 12px 8px; }

/* ---------------------------------------------------------------
   Dashboard (dashboard.html)
   --------------------------------------------------------------- */
.dash {
    overflow-y: auto; min-width: 0; padding: 22px 28px 40px;
    .greet { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
        h1 { margin: 0; font-size: 1.6em; font-weight: 650; } .date { color: var(--text-3); } }
    .stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
    .stat {
        display: flex; flex-direction: column; gap: 2px; min-width: 150px; padding: 10px 14px;
        border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); color: inherit;
        b { font-size: 1.5em; font-weight: 650; line-height: 1.1; } span { font-size: 0.85em; color: var(--text-2); }
        &:hover { border-color: var(--border-2); background: var(--bg); }
        &.warn b { color: var(--danger); }
    }
    .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; align-items: start; }
    .card {
        border: 1px solid var(--border); border-radius: 12px; background: var(--bg); overflow: hidden;
        &:has(.menu-host) { overflow: visible; }   /* the card clips its content; not while a dropdown menu is open */
        > h3 { border-radius: 11px 11px 0 0; display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 14px; font-size: 0.85em; font-weight: 600; text-transform: uppercase; color: var(--text-3); background: var(--bg-2); border-bottom: 1px solid var(--border);
               .grow { flex: 1; } .btn { height: 24px; text-transform: none; font-weight: 500; letter-spacing: 0; } a.more { font-weight: 500; text-transform: none; color: var(--info); } }
        .linked { border: 0; border-radius: 0; }
        .empty { padding: 14px; color: var(--text-3); font-size: 0.9em; }
        .ev.lg { height: auto; min-height: 34px; padding: 4px 10px 4px 8px; white-space: normal; .l { white-space: nowrap; } }
        .agenda-list { padding: 8px; }
        .due { color: var(--text-3); font-size: 0.85em; white-space: nowrap; &.over { color: var(--danger); font-weight: 600; } }
    }
}

/* ---------------------------------------------------------------
   Sign-in pages (login.html, accept.html, reset.html)
   --------------------------------------------------------------- */
body.auth {
    grid-template-columns: 1fr; place-items: center; overflow: auto;
    background: var(--bg-2);
}
.auth-card {
    width: min(400px, calc(100vw - 32px)); padding: 28px 30px 24px;
    border: 1px solid var(--border); border-radius: 16px; background: var(--bg); box-shadow: 0 10px 40px var(--shadow);
    .mark { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; svg { width: 30px; height: auto; }
        .word { font-size: 1.1em; background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; span { font-weight: 300; } b { font-weight: 500; } } }
    h1 { margin: 0 0 14px; font-size: 1.35em; font-weight: 650; }
    .lead { margin: 0 0 14px; color: var(--text-2); line-height: 1.5; }
    form { display: grid; gap: 12px; }
    label { display: grid; gap: 5px; font-size: 0.85em; color: var(--text-2); .hint { font-weight: 400; color: var(--text-3); margin-left: 4px; } }
    input { height: 36px; padding: 0 10px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; outline: 0;
        &:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
        &[readonly] { color: var(--text-2); background: var(--bg-2); } }
    .btn.big { height: 38px; justify-content: center; font-size: 1em; margin-top: 2px; }
    .err { margin: 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); font-size: 0.9em; }
    .ok  { margin: 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); font-size: 0.9em; }
    .links { margin: 6px 0 0; text-align: center; font-size: 0.9em; a { color: var(--info); } }
    .langs { margin: 18px 0 0; text-align: center; font-size: 0.85em; color: var(--text-3); a { color: inherit; margin: 0 6px; &.current { color: var(--text); font-weight: 600; } } }
}

/* ---------------------------------------------------------------
   Settings (settings.html)
   --------------------------------------------------------------- */
.dash.settings {
    .greet .btn { align-self: center; }
    .card.wide { grid-column: 1 / -1; }
    .form {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding: 14px;
        &.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        &.inset { margin: 10px 14px 0; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); }
        label { display: grid; gap: 4px; font-size: 0.85em; color: var(--text-2); min-width: 0; .hint { color: var(--text-3); font-weight: 400; } }
        input, select { height: 30px; padding: 0 8px; min-width: 0; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--bg); color: var(--text); font: inherit; outline: 0;
            &:focus { border-color: var(--brand); } &:disabled { color: var(--text-3); background: var(--bg-2); } }
        .frow { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; .grow { flex: 1; } .fine { margin: 0; color: var(--text-3); } }
    }
    .fine.pad { padding: 0 14px 12px; color: var(--text-3); }
    .linkbox { margin: 12px 14px 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--info) 40%, var(--border)); border-radius: 10px; background: color-mix(in srgb, var(--info) 6%, var(--bg));
        .row { display: flex; gap: 6px; margin-top: 6px; input { flex: 1; height: 28px; padding: 0 8px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--bg); color: var(--text); font: 12px var(--mono); } } }
    .utable {
        width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.95em;
        th { text-align: left; padding: 6px 10px; font-size: 0.8em; font-weight: 600; text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--border); }
        td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; .sub { display: block; font: 11px var(--mono); color: var(--text-3); } }
        tr:last-child td { border-bottom: 0; }
        tr.inactive td { color: var(--text-3); b { color: inherit; } }
        td:first-child { width: 34px; padding-right: 0; }
        .role { height: 26px; padding: 0 6px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--bg); color: inherit; font: inherit; font-size: 0.95em; &:disabled { opacity: .6; } }
        .muted { color: var(--text-3); }
    }
    .chip.ok   { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
    .chip.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
    .linked .l { display: grid; flex: 1; min-width: 0; b { font-weight: 600; } }
}

/* ---------------------------------------------------------------
   Event log (eventlog.html)
   --------------------------------------------------------------- */
.rows .l1 .tt { color: var(--text-2); font-weight: 400; }
.detail .diff {
    width: 100%; border-collapse: collapse;
    th { text-align: left; font-weight: 500; color: var(--text-2); padding: 6px 10px 6px 0; width: 160px; vertical-align: top; white-space: nowrap; }
    td { padding: 6px 0; vertical-align: top; }
    tr + tr th, tr + tr td { border-top: 1px solid var(--border); }
    .chg { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: baseline; .o { color: var(--text-3); text-decoration: line-through; } .a { color: var(--text-3); } .n { font-weight: 600; } }
}
.detail .note { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); p { margin: 0; white-space: pre-wrap; line-height: 1.5; } }
.detail .fields.plain { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; dt { color: var(--text-3); } dd { margin: 0; } }
/* Read-only accounts: hide what they cannot do */
body.readonly:not(:has(.settings)) :is(.btn.primary, .composer, .st-add) { display: none !important; }
