/* ChangeLogTrack — Design System
   Light, high-contrast corporate SaaS. Native UI type + Lucide icons.
   Hand-written Bootstrap 5 override layer, no preprocessor.
   Pattern ported from an internal reference project (caportal). */

/* ==========================================================
   1. Tokens
   ========================================================== */
:root {
    /* Brand */
    --pr: #2f6bff;
    --pr-hover: #1f56e6;
    --pr-active: #1848c9;
    --pr-ink: #1c50d8;
    --pr-bg: #eef3ff;
    --pr-bg-2: #dfe9ff;
    --pr-ring: rgba(47, 107, 255, .16);

    /* Semantic */
    --ok: #0a7c4a;
    --ok-bg: #e7f6ee;
    --warn: #a55a00;
    --warn-bg: #fdf2e3;
    --dang: #c92a3b;
    --dang-bg: #fdecee;
    --info: #0369a1;
    --info-bg: #e6f2fb;

    /* Neutrals */
    --canvas: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #fbfbfc;
    --surface-3: #f2f4f7;
    --line: #e8eaee;
    --line-2: #dcdfe6;

    /* Text */
    --tx: #14161a;
    --tx-2: #4d5462;
    --tx-3: #767d8c;

    /* Shape */
    --r-lg: 14px;
    --r: 10px;
    --r-sm: 8px;
    --r-pill: 999px;

    /* Elevation */
    --sh-sm: 0 1px 2px rgba(20, 22, 26, .04);
    --sh: 0 1px 2px rgba(20, 22, 26, .04), 0 2px 8px -2px rgba(20, 22, 26, .06);
    --sh-lg: 0 4px 12px -2px rgba(20, 22, 26, .08), 0 16px 32px -12px rgba(20, 22, 26, .16);

    /* Metrics */
    --sb-w: 258px;
    --sb-rail: 72px;
    --tb-h: 62px;

    --ease: 160ms cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

body {
    background: var(--canvas);
    color: var(--tx);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    font-size: 14px;
    line-height: 1.55;
}

/* ==========================================================
   2. Typography
   ========================================================== */
.t-display { font-size: 30px; font-weight: 700; }
.t-h1 { font-size: 20px; font-weight: 600; }
.t-h2 { font-size: 16px; font-weight: 600; }
.t-h3 { font-size: 14px; font-weight: 600; }
.t-body { font-size: 14px; }
.t-sm { font-size: 13px; }
.t-xs { font-size: 12px; }
.t-2 { color: var(--tx-2); }
.t-3 { color: var(--tx-3); }
.num { font-variant-numeric: tabular-nums; }

/* ==========================================================
   3. Icons (Lucide font — glyphs defined in lucide.css)
   ========================================================== */
.ic-sm { font-size: 1em; }
.ic-lg { font-size: 1.35em; }
.ic-xl { font-size: 2rem; }

/* Explicit, consistent icon sizes inside interactive elements — icons
   otherwise inherit font-size:inherit from lucide.css and end up whatever
   size their ambient container happens to be, which drifts between
   buttons/navbar/sidebar instead of reading as one coherent system. */
.btn > i[class^="icon-"], .btn > i[class*=" icon-"] { font-size: 15px; }
.act > i[class^="icon-"], .act > i[class*=" icon-"] { font-size: 15px; }
.iconbtn > i[class^="icon-"], .iconbtn > i[class*=" icon-"] { font-size: 17px; }
.userbtn i[class^="icon-"], .userbtn i[class*=" icon-"] { font-size: 15px; }
.dropdown-item > i[class^="icon-"], .dropdown-item > i[class*=" icon-"] {
    font-size: 15px;
    width: 18px;
    text-align: center;
}
.tb-search i[class^="icon-"], .search i[class^="icon-"] { font-size: 14px; }
.empty-ic i[class^="icon-"] { font-size: 20px; }
.stat-ic i[class^="icon-"] { font-size: 15px; }

/* ==========================================================
   4. Shell / Sidebar / Topbar
   ========================================================== */
.shell { min-height: 100vh; min-height: 100dvh; }

.main {
    margin-left: var(--sb-w);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--ease);
}

.content {
    flex: 1;
    padding: 24px 22px 40px;
    max-width: 1800px;
    width: 100%;
    margin-inline: auto;
}

.sb {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sb-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform var(--ease), width var(--ease);
}

.sb-brand {
    height: var(--tb-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-bottom: 1px solid var(--line);
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(140deg, #4f83ff 0%, var(--pr) 55%, #1e46c8 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.brand-name { font-weight: 700; font-size: 14px; display: block; }
.brand-sub { font-size: 11px; color: var(--tx-3); display: block; }

.sb-close { margin-left: auto; }

.sb-nav { flex: 1; overflow-y: auto; padding: 12px 12px 8px; }

.nav-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tx-3);
    padding: 14px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    border-radius: var(--r);
    color: #3f4553;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--ease), color var(--ease);
}

.nav-item:hover { background: var(--surface-3); color: var(--tx); }
.nav-item > i[class^="icon-"], .nav-item > i[class*=" icon-"] {
    font-size: 17px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.nav-item.active { background: var(--pr-bg); color: var(--pr-ink); font-weight: 600; }
.nav-item.soon { color: #6a7180; cursor: default; }
.nav-text { flex: 1; }
.chip-soon {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--surface-3);
    color: var(--tx-3);
    padding: 1px 6px;
    border-radius: var(--r-pill);
}

.sb-foot { padding: 12px 14px; border-top: 1px solid var(--line); }
.sb-user { display: flex; align-items: center; gap: 10px; }
.sb-user-name { font-size: 13px; font-weight: 600; }
.sb-user-role { font-size: 11px; color: var(--tx-3); }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--pr-bg);
    color: var(--pr-ink);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

@media (min-width: 992px) {
    body.rail .sb { width: var(--sb-rail); }
    body.rail .main { margin-left: var(--sb-rail); }
    body.rail .brand-tx, body.rail .nav-text, body.rail .chip-soon,
    body.rail .nav-label, body.rail .sb-user-meta { display: none; }
    body.rail .nav-item { justify-content: center; }
    body.rail .sb-user { justify-content: center; }
}

.backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 22, 26, .42);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .sb { transform: translateX(-100%); box-shadow: var(--sh-lg); }
    body.sb-open .sb { transform: translateX(0); }
    body.sb-open .backdrop { display: block; }
    .main { margin-left: 0; }
    .sb-brand .sb-close { display: inline-flex; }
}

@media (min-width: 992px) {
    .sb-brand .sb-close { display: none; }
}

.tb {
    height: var(--tb-h);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 1030;
    flex-shrink: 0;
}

.tb-title { font-size: 16px; font-weight: 600; margin: 0; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tx-3); }
.crumbs a { color: var(--tx-3); text-decoration: none; }
.crumbs a:hover { color: var(--pr); }
.crumbs .sep { color: #c2c7d0; }

.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.iconbtn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--tx-2);
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.iconbtn:hover { background: var(--surface-2); border-color: #c9cdd6; color: var(--tx); }

/* Modal close buttons read as circular, distinct from square panel toggles. */
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.modal-header .iconbtn { border-radius: 50%; flex-shrink: 0; margin-left: auto; }

/* Header that stacks a second full-width row below the title/close row
   (e.g. logs' collapsible "Project details" panel) — a plain column stack
   instead of relying on flex-wrap, which can squeeze a width:100% item
   into the first row instead of wrapping it if there's still room. */
.modal-header.modal-header-stacked { flex-direction: column; align-items: stretch; }
.modal-header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* Collapsible toggles (e.g. View Log's "Project details") — Bootstrap
   toggles .collapsed on the trigger itself as the panel opens/closes. */
.js-collapse-toggle .collapse-chevron { transition: transform var(--ease); }
.js-collapse-toggle:not(.collapsed) .collapse-chevron { transform: rotate(90deg); }

/* Project/Change Type selects sitting inline in the modal header next to
   the title (logs' Add/Edit modals) — sized to their own content instead
   of stretching full-width like a normal form-select. */
.modal-header-fields .form-select { width: auto; min-width: 160px; }

/* .modal-title is an <h2> with no font-size override, so it renders at the
   browser's large default heading size — disproportionate for a modal
   header and, in the full-page modals, pushes the actual form content
   down further than it needs to be. */
.modal-title { font-size: 20px; font-weight: 700; line-height: 1.3; }

.userbtn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line-2);
    background: var(--surface);
    border-radius: var(--r-pill);
    padding: 4px 10px 4px 4px;
    transition: border-color var(--ease), background var(--ease);
}
.userbtn:hover { background: var(--surface-2); }
.userbtn-name { font-size: 13px; font-weight: 600; }
.userbtn-role { font-size: 11px; color: var(--tx-3); }

.dropdown-head { padding: 10px 14px 6px; }
.dropdown-head-name { font-size: 13px; font-weight: 600; }
.dropdown-head-mail { font-size: 12px; color: var(--tx-3); }
.dropdown-item.danger { color: var(--dang); }
.dropdown-item.danger:hover { background: var(--dang-bg); color: var(--dang); }

.foot {
    padding: 14px 28px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--tx-3);
}

/* ==========================================================
   5. Cards / Stats
   ========================================================== */
.card2 { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); }
.card2-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card2-title { font-size: 15px; font-weight: 600; }
.card2-sub { font-size: 12px; color: var(--tx-3); margin: 2px 0 0; }
.card2-body { padding: 18px; }
.card2-body.flush { padding: 0; }

.page-head { margin-bottom: 18px; display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 10px; }

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
    padding: 16px 18px 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color var(--ease), box-shadow var(--ease);
    height: 100%;
}
.stat:hover { border-color: var(--line-2); box-shadow: var(--sh); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 12px; color: var(--tx-2); font-weight: 600; }
.stat-ic { width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; font-size: 15px; }
.stat-val { font-size: 27px; font-weight: 700; }
.stat-foot { font-size: 12px; color: var(--tx-3); }

.tone-pr { background: var(--pr-bg); color: var(--pr-ink); }
.tone-ok { background: var(--ok-bg); color: var(--ok); }
.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tone-dang { background: var(--dang-bg); color: var(--dang); }
.tone-info { background: var(--info-bg); color: var(--info); }
.tone-mute { background: var(--surface-3); color: var(--tx-2); }

.empty { text-align: center; padding: 40px 20px; }
.empty-ic { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-3); color: var(--tx-3); display: grid; place-items: center; font-size: 20px; margin: 0 auto 10px; }
.empty-title { font-weight: 600; font-size: 14px; }
.empty-text { font-size: 12px; color: var(--tx-3); margin-top: 2px; }

/* ==========================================================
   6. Buttons
   ========================================================== */
.btn {
    border-radius: var(--r);
    font-size: 13px;
    font-weight: 500;
    padding: 7px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    transition: var(--ease);
    white-space: nowrap;
}
.btn-primary { background: var(--pr); border-color: var(--pr); color: #fff; box-shadow: 0 1px 2px rgba(20, 22, 26, .08); }
.btn-primary:hover { background: var(--pr-hover) !important; border-color: var(--pr-hover) !important; color: #fff; }
.btn-primary:active { background: var(--pr-active) !important; border-color: var(--pr-active) !important; }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--tx); }
.btn-ghost:hover { background: var(--surface-2); border-color: #c9cdd6; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--tx-2); }
.btn-quiet:hover { background: var(--surface-3); }
.btn-danger { background: var(--dang); border-color: var(--dang); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-lg { padding: 10px 16px; font-size: 14px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ==========================================================
   7. Badges
   ========================================================== */
.badge2 {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 2.5px 8px;
    border-radius: 6px;
}
.badge2::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.b-pr { background: var(--pr-bg); color: var(--pr-ink); }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-dang { background: var(--dang-bg); color: var(--dang); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-mute { background: var(--surface-3); color: #161616; }

/* A .badge2 that's also a clickable toggle (e.g. View Log's project badge)
   instead of a plain <span> — strip the browser's own button chrome so it
   still reads as a badge, not a button. */
button.badge2 { border: 0; font: inherit; cursor: pointer; }

.table-tag {
    display: inline-block;
    font-size: 11px;
    background: var(--surface-3);
    color: var(--tx-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 1px 6px;
    margin-top: 3px;
}

/* ==========================================================
   8. Tables / toolbar / pager
   ========================================================== */
.tbl-wrap { overflow-x: auto; }

table.tbl { width: 100%; margin: 0; border-collapse: collapse; font-size: 14px; }
table.tbl thead th {
    background: var(--pr-bg);
    border-bottom: 1px solid var(--line-2);
    border-right: 1px solid var(--line-2);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .055em;
    padding: 10px 14px;
    white-space: nowrap;
    text-align: left;
}
table.tbl thead th.sortable { cursor: pointer; user-select: none; }
table.tbl thead th.sortable:hover { background: var(--pr-bg-2); }
table.tbl thead th.sr { width: 44px; }
table.tbl thead th.r, table.tbl tbody td.r { text-align: right; }
.sort-ic { font-size: .85em; margin-left: 3px; opacity: .6; }
th.asc .sort-ic, th.desc .sort-ic { opacity: 1; color: var(--pr); }

table.tbl tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    vertical-align: middle;
}
table.tbl tbody tr:nth-child(odd) > td { background: var(--surface); }
table.tbl tbody tr:nth-child(even) > td { background: #f5f7fa; }
table.tbl tbody tr > td:first-child { box-shadow: inset 3px 0 0 transparent; }
table.tbl tbody tr:hover > td,
table.tbl tbody tr.row-on > td { background: var(--pr-bg); }
table.tbl tbody tr:hover > td:first-child,
table.tbl tbody tr.row-on > td:first-child { box-shadow: inset 3px 0 0 var(--pr); }

.cell-1 { font-weight: 600; font-size: 13.5px; }
.cell-2 { font-size: 12px; color: var(--tx-3); }

.row-acts { display: flex; gap: 6px; justify-content: flex-end; }
.act {
    width: 30px;
    height: 30px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-2);
    background: var(--surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--tx-2);
    transition: var(--ease);
}
.act:hover { border-color: var(--pr); background: var(--pr-bg); color: var(--pr-ink); }
.act.danger:hover { border-color: var(--dang); background: var(--dang-bg); color: var(--dang); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar > .form-select, .toolbar > .inp, .toolbar .btn {
    height: 34px;
    min-height: 34px;
    font-size: 13px;
    line-height: 20px;
    width: auto;
    flex: 0 0 auto;
    padding-top: 6px;
    padding-bottom: 6px;
}
.toolbar > .form-select { min-width: 150px; padding-left: 10px; padding-right: 30px; background-position: right 8px center; }
.toolbar > .inp { padding-left: 10px; padding-right: 10px; }
.toolbar > input.inp[type="date"] { min-width: 150px; }
.toolbar > .len-select { min-width: 68px; }

.search { position: relative; display: flex; align-items: center; margin: 0; }
.search i { position: absolute; left: 10px; color: var(--tx-3); font-size: 13px; }
.search .inp { padding-left: 30px; width: 200px; }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; gap: 10px; }
.pager-info { font-size: 12px; color: var(--tx-3); }
.pager-nav { display: flex; align-items: center; gap: 4px; }
.pager-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-2);
    background: var(--surface);
    color: var(--tx-2);
    font-size: 12px;
    transition: var(--ease);
}
.pager-btn:hover:not(:disabled) { border-color: var(--pr); color: var(--pr-ink); }
.pager-btn:disabled { opacity: .4; cursor: default; }
.pager-btn.on { background: var(--pr); border-color: var(--pr); color: #fff; }
.pager-gap { color: var(--tx-3); padding: 0 4px; font-size: 12px; }

/* ==========================================================
   9. Forms
   ========================================================== */
.lbl { font-size: 12.5px; font-weight: 600; color: var(--tx-2); margin-bottom: 5px; display: block; }
.lbl-row { display: flex; justify-content: space-between; align-items: center; }
.req { color: var(--dang); }
.field { margin-bottom: 16px; }
.field-hint { font-size: 11.5px; color: var(--tx-3); margin-top: 4px; }
.field-err { font-size: 11.5px; color: var(--dang); margin-top: 4px; }

.inp, .form-control, .form-select {
    width: 100%;
    font-size: 14px;
    color: var(--tx);
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    padding: 9px 12px;
    transition: var(--ease);
    appearance: none;
}
.inp:focus, .form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--pr);
    box-shadow: 0 0 0 3px var(--pr-ring);
}
.inp.bad, .form-control.bad, .form-select.bad { border-color: var(--dang); }

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23767d8c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5l3.5 3.5 3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 32px;
}

.inp-wrap, .inp-ic { position: relative; display: flex; align-items: center; }
.inp-ic .lead { position: absolute; left: 12px; color: var(--tx-3); }
.inp-ic .inp { padding-left: 36px; }
.inp.has-btn { padding-right: 40px; }
.inp-btn {
    position: absolute;
    right: 4px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--tx-3);
    border-radius: var(--r-sm);
}
.inp-btn:hover { background: var(--surface-3); color: var(--tx); }

.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--tx-2); }

.note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--r); font-size: 12.5px; margin-bottom: 14px; }
.note-info { background: var(--info-bg); color: var(--info); }
.note-dang { background: var(--dang-bg); color: var(--dang); }

.upload-preview { display: none; max-width: 200px; max-height: 160px; border: 1px solid var(--line); border-radius: var(--r); padding: 6px; }
.upload-preview img { max-width: 100%; max-height: 148px; display: block; border-radius: var(--r-sm); }

.attachment-list { display: flex; flex-direction: column; gap: 6px; }
.attachment-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    background: var(--surface-2);
}
.attachment-chip-ic { color: var(--tx-3); font-size: 16px; flex-shrink: 0; }
.attachment-chip-name { font-size: 12.5px; font-weight: 500; color: var(--tx); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip-size { font-size: 11.5px; color: var(--tx-3); flex-shrink: 0; }
.attachment-chip-remove {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--tx-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--ease);
}
.attachment-chip-remove:hover { background: var(--dang-bg); color: var(--dang); }
.attachment-chip.removing { opacity: .45; text-decoration: line-through; }
.attachment-chip.bad { border-color: var(--dang); background: var(--dang-bg); }
.attachment-chip.bad .attachment-chip-ic, .attachment-chip.bad .attachment-chip-name { color: var(--dang); }
.attachment-chip-err { margin: -2px 0 2px; }

/* Quick attachment popover from the list's Attachment badge. Positioned
   against the viewport (fixed) and appended to <body> by JS rather than
   nested in the table — .tbl-wrap scrolls horizontally, and a child
   positioned relative to a scrolling ancestor gets clipped/dragged along
   with it instead of floating freely above everything. */
.attachment-trigger { display: inline-block; }
.attachment-popover {
    position: fixed;
    z-index: 1060;
    min-width: 220px;
    max-width: 320px;
    max-height: 260px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    box-shadow: var(--sh-lg);
    padding: 6px;
}
.attachment-popover .attachment-chip { text-decoration: none; }

/* ==========================================================
   10. Loading / spinner
   ========================================================== */
.loader {
    position: fixed;
    inset: 0;
    background: rgba(247, 248, 250, .7);
    backdrop-filter: blur(2px);
    z-index: 2000;
    display: none;
    place-items: center;
}
.loader.on { display: grid; }
.spinner {
    width: 34px;
    height: 34px;
    border: 2.5px solid var(--line-2);
    border-top-color: var(--pr);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 44px 20px;
    color: var(--tx-3);
    font-size: 13px;
}
.loading-block .spinner { width: 26px; height: 26px; border-width: 2px; }

.retry-block { text-align: center; padding: 40px 20px; }

/* ==========================================================
   11. Auth stage (login)
   ========================================================== */
.stage {
    position: relative;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px 32px;
    overflow: hidden;
    background:
        radial-gradient(1100px 700px at 50% -10%, #1c2740 0%, transparent 62%),
        linear-gradient(168deg, #0e1219 0%, #0b0e14 48%, #0d1119 100%);
}

.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none; }
.orb-1 { width: 420px; height: 420px; top: -120px; left: -80px; background: #2f6bff; animation: drift-a 16s ease-in-out infinite; }
.orb-2 { width: 360px; height: 360px; bottom: -140px; right: -80px; background: #7c3aed; animation: drift-b 18s ease-in-out infinite; }
.orb-3 { width: 260px; height: 260px; top: 40%; right: 15%; background: #0ea5e9; opacity: .35; animation: drift-c 20s ease-in-out infinite; }
@keyframes drift-a { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(30px, 20px); } }
@keyframes drift-b { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-24px, -18px); } }
@keyframes drift-c { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-16px, 24px); } }

.auth-wrap { position: relative; z-index: 1; width: 100%; max-width: 400px; }
.auth-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-lg);
    padding: 30px 28px 26px;
}
.auth-badge {
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(140deg, #4f83ff 0%, var(--pr) 55%, #1e46c8 100%);
    color: #fff;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 14px;
}
.auth-head-wrap { margin-bottom: 20px; }
.auth-eyebrow { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--pr-ink); }
.auth-title2 { font-size: 21px; font-weight: 700; margin: 8px 0 4px; }
.auth-sub2 { font-size: 13px; color: var(--tx-3); margin: 0; }
.auth-legal { position: relative; z-index: 1; margin-top: 22px; color: rgba(255, 255, 255, .45); font-size: 11.5px; }

/* ==========================================================
   12. Toastr / SweetAlert overrides
   ========================================================== */
#toast-container > div { border-radius: var(--r); box-shadow: var(--sh-lg); opacity: 1; }
.swal2-popup { border-radius: var(--r-lg) !important; font-family: inherit !important; }

/* ==========================================================
   13. Utilities
   ========================================================== */
.status-badge { text-transform: capitalize; }

/* ==========================================================
   14. Detail view (read-only View modals)
   ========================================================== */
.detail-hero {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--tx);
    white-space: pre-wrap;
    margin-bottom: 18px;
}

/*
   Change log content is real HTML from CKEditor, not plain text — the
   pre-wrap above (for Project's plain-text description) would otherwise
   turn raw newlines between saved block tags into visible extra gaps.
   The `ck-content` class (CKEditor's own bundled content styles, already
   loaded via ckeditor.js) is what makes tables/images/headings etc. render
   exactly as they do inside the editor itself.
*/
.detail-hero.ck-content { white-space: normal; }

.detail-section { margin-bottom: 18px; }
.detail-section:last-child { margin-bottom: 0; }
.detail-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--tx-3);
    margin-bottom: 8px;
}

.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.detail-grid-full { grid-column: 1 / -1; }
.detail-field-label { font-size: 11.5px; color: var(--tx-3); margin-bottom: 3px; }
.detail-field-value { font-size: 13.5px; font-weight: 500; color: var(--tx); }
.detail-field-value.muted { color: var(--tx-3); font-weight: 400; }

/* Compact "Label: value" pairs sitting inline in a row (e.g. the Project
   details panel's RTID/Type/Status and Tester/Dev/Sysadmin lines) —
   unlike .detail-field-label/.detail-field-value, these don't stack the
   label above the value, so a handful of fields fit on one short line. */
.detail-mini { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--tx); }
.detail-mini-label { color: var(--tx-3); font-weight: 500; }

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding-top: 14px;
    margin-top: 4px;
    border-top: 1px solid var(--line);
}
.detail-meta-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tx-3); }
.detail-meta-item i { font-size: 14px; }
.detail-meta-item strong { color: var(--tx-2); font-weight: 600; }

/* ==========================================================
   15. Picker — searchable multi-select (chips + filtered dropdown)
   ========================================================== */
.picker { position: relative; }
.picker-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.picker-chips:empty { display: none; }
.picker-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--pr-bg);
    color: var(--pr-ink);
    border-radius: var(--r-pill);
    padding: 3px 6px 3px 10px;
    font-size: 12px;
    font-weight: 500;
}
.picker-chip-remove {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--pr-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: .75;
}
.picker-chip-remove:hover { background: rgba(28, 80, 216, .16); opacity: 1; }

.picker-menu {
    position: absolute;
    z-index: 1060;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    box-shadow: var(--sh-lg);
    padding: 4px;
}
.picker-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--tx);
    cursor: pointer;
}
.picker-option:hover, .picker-option.active { background: var(--surface-3); }

/*
   CKEditor's editable area otherwise grows to fit its content with no cap,
   forcing the surrounding .modal-fullscreen .modal-body (which has its own
   overflow-y: auto) to become the scrolling container. CKEditor's toolbar
   then tries to stick itself to the top of that ancestor as it scrolls,
   and for a long change log that calculation breaks down — the toolbar
   renders twice, overlapping the content underneath it. Capping the
   editable box itself and letting IT scroll internally keeps the toolbar
   in normal (non-scrolling) flow above it, so there's no ancestor to
   stick against in the first place.
*/
.ck-editor__editable_inline {
    min-height: 320px;
    max-height: 55vh;
    overflow-y: auto;
}

/*
   CKEditor renders its floating balloon toolbars (table properties, cell
   properties, link, image, find & replace) into .ck-balloon-panel elements
   appended to document.body - outside the modal - at
   z-index: var(--ck-z-modal), which the bundle defaults to
   calc(var(--ck-z-default) + 999) = 1000. Every one of our editors lives
   inside a Bootstrap modal, and .modal sits at z-index 1055, so those
   balloons were being drawn behind the modal and were invisible - the
   table toolbar looked like it simply never appeared. Lifting the base
   puts them at 1099, above the modal but still below the .loader overlay.

   ckeditor.js injects its own :root{--ck-z-default:1} into <head> at
   runtime, after this file's <link>, so the selectors below are written to
   out-specify it rather than rely on source order.
*/
html:root {
    --ck-z-default: 100;
}
.ck.ck-balloon-panel {
    z-index: 1099;
}
.picker-empty { padding: 12px 10px; font-size: 12.5px; color: var(--tx-3); text-align: center; }
