/* ============================================================
   QBIS Ticket — app.css (theme QBIS light)
   ============================================================ */
:root {
    --navy-900: #14296b;
    --navy-800: #1a3381;
    --blue-600: #2041b4;
    --periwinkle: #879aff;
    --blue-200: #d6e2fb;
    --blue-100: #eaf0ff;
    --yellow-500: #fcda0c;
    --yellow-300: #ffdc70;
    --cream-100: #fff1c5;
    --orange-500: #fb8500;
    --coral-500: #ff6b5f;
    --teal-500: #34c99a;
    --cyan-500: #2bc4f2;
    --ink-900: #14193a;
    --ink-700: #2f3550;
    --gray-500: #6b7280;
    --gray-300: #c9ccd6;
    --surface-100: #f5f7fb;
    --border-subtle: #e8ebf2;
    --border-default: #dfe3ec;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background: var(--surface-100);
    color: var(--ink-900);
    font-size: 13.5px;
}
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--navy-800); }
::placeholder { color: #9aa1b5; }
input, select, textarea, button { font-family: 'Be Vietnam Pro', sans-serif; }
.spacer { flex: 1; }
.muted { color: var(--gray-500); }
b { font-weight: 700; }
[ui-view], .app-shell { height: 100vh; }

/* ---------- Buttons ---------- */
button { cursor: pointer; }
.btn-accent {
    display: inline-flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 16px;
    background: var(--yellow-500); color: var(--navy-900);
    font-weight: 700; font-size: 13.5px;
    border: none; border-radius: 8px; white-space: nowrap;
    transition: filter .15s;
}
.btn-accent:hover { filter: brightness(.95); }
.btn-accent:active { transform: scale(.97); }
.btn-accent .plus { font-size: 17px; line-height: 1; margin-top: -2px; }
.btn-accent.sm { height: 30px; padding: 0 14px; font-size: 12.5px; }
.btn-accent.btn-block { width: 100%; height: 46px; font-size: 15px; justify-content: center; }
.btn-primary {
    height: 40px; padding: 0 16px;
    background: var(--blue-600); color: #fff;
    font-weight: 700; font-size: 13px;
    border: none; border-radius: 8px; white-space: nowrap;
}
.btn-primary:hover { background: var(--navy-800); }
.btn-primary.pill { border-radius: 100px; height: 38px; padding: 0 18px; }
.btn-muted {
    height: 36px; padding: 0 16px;
    background: var(--surface-100); color: var(--ink-700);
    font-weight: 600; font-size: 13px;
    border: none; border-radius: 8px;
}
.btn-muted:hover { background: var(--blue-100); }
.btn-outline-light {
    display: inline-flex; align-items: center; gap: 7px;
    background: transparent; border: 1px solid rgba(255,255,255,.4);
    color: #fff; font-size: 13px; padding: 7px 14px;
    border-radius: 100px; white-space: nowrap;
    transition: background .15s;
}
.btn-outline-light:hover { background: rgba(255,255,255,.12); }
.icon-btn {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: var(--surface-100);
    border-radius: 8px; color: var(--gray-500); font-size: 15px;
}
.icon-btn:hover { background: var(--blue-100); }
.icon-btn.danger:hover { background: #ffecea; color: var(--coral-500); }
.icon-btn.round {
    width: 38px; height: 38px; border-radius: 50%;
    background: #fff; border: 1px solid var(--border-default);
}
.icon-btn.round:hover { border-color: var(--blue-600); color: var(--blue-600); }
.dash-btn {
    align-self: flex-start;
    background: #fff; border: 1px dashed var(--gray-300);
    color: var(--gray-500); font-size: 12.5px;
    border-radius: 8px; padding: 7px 14px;
}
.dash-btn:hover { border-color: var(--blue-600); color: var(--blue-600); }

/* ---------- Avatar ---------- */
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    color: #fff; font-size: 13px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar.sm2 { width: 28px; height: 28px; font-size: 11px; }
.assignee-avatars {
    display: inline-flex; align-items: center;
    flex-wrap: wrap; gap: 2px;
}
.assignee-av {
    position: relative;
    overflow: hidden;
    cursor: default;
}
.assignee-av img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    border-radius: 50%;
}
.assignee-field {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 28px;
}
.assignee-tags { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.assignee-tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px;
    border-radius: 100px;
    background: transparent;
}
.assignee-tag.named {
    padding: 2px 10px 2px 2px;
    background: var(--surface-100, #f3f4f6);
    border: 1px solid var(--border-subtle, #e5e7eb);
}
.assignee-tag-name {
    font-size: 13px; font-weight: 600; color: var(--ink-700);
    max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.edit-ico {
    width: 28px; height: 28px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid transparent; background: transparent; border-radius: 6px;
    color: var(--gray-500); cursor: pointer; flex-shrink: 0;
}
.edit-ico:hover {
    color: var(--blue-600); background: var(--blue-50, #eef2ff);
    border-color: var(--border-subtle, #e5e7eb);
}
.section-label-row {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.rich-html {
    font-size: 13.5px; line-height: 1.65;
    color: var(--ink-700);
    word-break: break-word; overflow-wrap: anywhere;
}
.rich-html p { margin: 0 0 0.55em; }
.rich-html p:last-child { margin-bottom: 0; }
.rich-html b, .rich-html strong { font-weight: 650; color: var(--ink-900, #111827); }
.rich-html i, .rich-html em { font-style: italic; }
.rich-html ul, .rich-html ol { margin: 0.35em 0 0.55em 1.25em; padding: 0; }
.rich-html li { margin: 0.2em 0; }
.rich-html a { color: var(--blue-600); text-decoration: underline; }
.rich-html img { max-width: 100%; height: auto; border-radius: 4px; }
.rich-html table { border-collapse: collapse; max-width: 100%; margin: 0.4em 0; font-size: 13px; }
.rich-html td, .rich-html th { border: 1px solid var(--border-default, #e5e7eb); padding: 4px 8px; }
.rich-html h1, .rich-html h2, .rich-html h3, .rich-html h4 {
    margin: 0.5em 0 0.35em; font-size: 14px; font-weight: 650; color: var(--ink-900, #111827);
}
.desc-html {
    display: block;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    border: none;
    border-radius: 0;
    padding: 4px 0 8px;
    background: transparent;
    min-height: 0;
    max-height: none;
    /* Chứa float/overflow từ HTML mô tả — tránh đè Đính kèm bên dưới */
    overflow: hidden;
    clear: both;
}
.desc-html:after {
    content: "";
    display: table;
    clear: both;
}
.desc-html.empty {
    color: var(--gray-500); font-style: italic;
    min-height: 0; max-height: none; overflow: visible;
}
.desc-html * { max-width: 100% !important; }
.desc-html img, .desc-html table { height: auto !important; }
.desc-html div,
.desc-html p,
.desc-html span,
.desc-html table,
.desc-html td,
.desc-html th {
    position: static !important;
    float: none !important;
}
.desc-block,
.attach-block,
.comments-block {
    position: relative;
    display: block;
    width: 100%;
    clear: both;
    flex: 0 0 auto;
    z-index: 1;
}
.attach-block { margin-top: 2px; }
.attach-add-link {
    flex-shrink: 0;
    height: 24px; padding: 0 8px;
    border: none; background: transparent;
    font-size: 12px; font-weight: 600;
    color: var(--blue-600, #2563eb);
    border-radius: 4px; cursor: pointer;
    text-transform: none; letter-spacing: 0;
}
.attach-add-link:hover:not(:disabled) {
    background: var(--blue-50, #eef2ff);
}
.attach-add-link:disabled {
    opacity: .5; cursor: not-allowed;
}
.assignee-edit-tags {
    display: flex; flex-wrap: wrap; gap: 8px; min-height: 32px; margin-bottom: 10px;
}
.modal-ac { position: relative; }
.modal-ac input {
    width: 100%; height: 38px; box-sizing: border-box;
    border: 1px solid var(--border-default); border-radius: 8px;
    padding: 0 12px; font-size: 14px; outline: none;
}
.modal-ac input:focus { border-color: var(--blue-600); }
.modal-ac .ac-list {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
    margin: 4px 0 0; padding: 4px 0; list-style: none;
    background: #fff; border: 1px solid var(--border-default); border-radius: 8px;
    max-height: 220px; overflow: auto; box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.modal-ac .ac-list li {
    padding: 8px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.modal-ac .ac-list li:hover { background: var(--surface-100, #f3f4f6); }
.modal-actions { display: flex; gap: 8px; }
.modal.modal-sm { width: 440px; max-width: calc(100vw - 32px); }
.modal.modal-desc { width: 560px; max-width: calc(100vw - 32px); }
.modal.modal-attach { width: 480px; max-width: calc(100vw - 32px); }
.attach-lead { margin: -4px 0 14px; font-size: 13.5px; color: var(--gray-500); line-height: 1.45; }
.attach-pick-btn { width: 100%; height: 40px; margin-bottom: 12px; }
.attach-paste-label {
    display: block; font-size: 12.5px; font-weight: 600;
    color: var(--gray-500); margin: 0 0 6px;
}
.attach-paste-textarea {
    width: 100%; box-sizing: border-box;
    min-height: 110px;
    border: 2px dashed var(--border-default, #d1d5db);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 13.5px; line-height: 1.45;
    color: var(--ink-700);
    background: var(--surface-50, #f9fafb);
    resize: vertical; outline: none;
    font-family: inherit;
}
.attach-paste-textarea:focus {
    border-color: var(--blue-600);
    background: var(--blue-50, #eef2ff);
}
.attach-paste-textarea.busy { opacity: .7; }
.attach-ok {
    margin-top: 10px; font-size: 13px; color: #15803d;
    background: #ecfdf5; border: 1px solid #bbf7d0;
    border-radius: 8px; padding: 8px 10px;
}
.desc-edit-area {
    width: 100%; box-sizing: border-box;
    border: 1px solid var(--border-default); border-radius: 8px;
    padding: 12px; font-size: 14px; line-height: 1.55;
    resize: vertical; min-height: 220px; outline: none;
    font-family: inherit;
}
.desc-edit-area:focus { border-color: var(--blue-600); }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: flex; }
.login-hero {
    flex: 1.1;
    background: linear-gradient(170deg, #1a3381 0%, #14296b 100%);
    display: flex; flex-direction: column; justify-content: center;
    padding: 64px; gap: 24px;
}
.login-logo { width: 150px; }
.login-headline {
    font-size: 40px; font-weight: 800; color: #fff;
    line-height: 1.15; letter-spacing: .5px;
}
.login-headline .hl {
    background: var(--yellow-500); color: var(--navy-900);
    padding: 0 10px; border-radius: 6px;
}
.login-sub { color: #c0cfff; font-size: 15px; max-width: 380px; line-height: 1.6; }
.login-form-wrap { flex: 1; display: flex; align-items: center; justify-content: center; background: #fff; }
.login-form { width: 360px; display: flex; flex-direction: column; gap: 16px; }
.login-form h1 { font-size: 26px; font-weight: 800; margin: 0; }
.login-form .muted { font-size: 14px; margin: -8px 0 0; }
.login-form label { font-size: 13px; font-weight: 600; color: var(--ink-700); margin-bottom: -10px; }
.login-form input {
    height: 44px; border: 1px solid var(--border-default);
    border-radius: 8px; padding: 0 14px; font-size: 15px; outline: none;
}
.login-form input:focus { border-color: var(--blue-600); }
.login-error { color: var(--coral-500); font-size: 13px; }
.login-links { display: flex; justify-content: space-between; font-size: 13px; }

/* ---------- Shell / Topbar ---------- */
.app-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar {
    height: 56px; background: var(--navy-800);
    display: flex; align-items: center; padding: 0 20px; gap: 14px;
    flex-shrink: 0;
}
.topbar-logo { height: 28px; width: auto; display: block; }
.topbar-brand {
    display: flex; align-items: center; gap: 10px; min-width: 0;
}
.topbar-store-logo {
    width: 34px; height: 34px; border-radius: 8px; object-fit: cover;
    background: #fff; flex-shrink: 0;
}
.topbar-store-logo-fallback {
    background: transparent; width: auto; height: 26px; border-radius: 0;
}
.topbar-store-meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.topbar-store-name {
    color: #fff; font-weight: 700; font-size: 13.5px; line-height: 1.2;
    max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-app-label {
    color: rgba(255,255,255,.65); font-size: 10.5px; font-weight: 700;
    letter-spacing: 1px; text-transform: uppercase;
}
.topbar-title {
    color: #fff; font-weight: 700; font-size: 15px;
    border-left: 1px solid rgba(255,255,255,.25);
    padding-left: 14px; letter-spacing: 1px;
}
.topbar-user .avatar {
    object-fit: cover;
}
.guest-badge {
    background: var(--yellow-500); color: var(--navy-900);
    font-size: 12px; font-weight: 700;
    padding: 5px 12px; border-radius: 100px; white-space: nowrap;
}
.board-select {
    height: 30px; max-width: 220px;
    border-radius: 8px; border: 1px solid rgba(255,255,255,.35);
    background: rgba(255,255,255,.12); color: #fff;
    font-size: 12.5px; font-weight: 600; padding: 0 8px;
}
.board-select option { color: #14193a; }
.board-label { color: #c0cfff; font-size: 13px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 9px; color: #fff; font-size: 13.5px; }
.topbar-user a { color: #c0cfff; font-size: 12.5px; }
.topbar-user a:hover { color: #fff; }

/* ---------- Toolbar ---------- */
.toolbar {
    background: #fff; border-bottom: 1px solid var(--border-subtle);
    padding: 12px 20px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    flex-shrink: 0;
}
.search-box { position: relative; }
.search-box svg { position: absolute; left: 11px; top: 9px; }
.search-box input {
    height: 34px; width: 230px;
    border: 1px solid var(--border-default); border-radius: 8px;
    padding: 0 12px 0 33px; font-size: 13.5px; outline: none;
}
.search-box input:focus { border-color: var(--blue-600); }
.toolbar select {
    height: 34px; border: 1px solid var(--border-default);
    border-radius: 8px; padding: 0 8px; font-size: 13.5px;
    color: var(--ink-700); background: #fff; outline: none;
}
.ac-filter {
    position: relative;
    min-width: 200px;
}
.ac-filter-tag { min-width: 160px; }
.ac-filter-tag input { width: 160px; padding-right: 28px; }
.ac-filter .ac-clear {
    position: absolute; right: 6px; top: 50%; margin-top: -10px;
    width: 20px; height: 20px; padding: 0;
    border: none; background: transparent; border-radius: 50%;
    color: var(--gray-500); cursor: pointer; font-size: 11px; line-height: 1;
    z-index: 2;
}
.ac-filter .ac-clear:hover { background: var(--surface-100); color: var(--ink-700); }
.ac-filter input {
    height: 34px; width: 220px;
    border: 1px solid var(--border-default); border-radius: 8px;
    padding: 0 10px; font-size: 13.5px; outline: none;
    color: var(--ink-700); background: #fff;
}
.ac-filter input:focus { border-color: var(--blue-600); }
.ac-list {
    position: absolute; z-index: 40; left: 0; right: 0; top: 36px;
    margin: 0; padding: 4px 0; list-style: none;
    background: #fff; border: 1px solid var(--border-default);
    border-radius: 8px; box-shadow: 0 8px 24px rgba(20,25,58,.12);
    max-height: 220px; overflow: auto;
}
.ac-list li {
    padding: 8px 12px; cursor: pointer;
    display: flex; flex-direction: column; gap: 2px;
    font-size: 13px;
}
.ac-list li:hover { background: var(--blue-100); }
.ac-list li b { font-weight: 600; color: var(--ink-700); }
.filter-tags {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 8px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.filter-tags-label {
    font-size: 12px; font-weight: 700; color: var(--gray-500);
    white-space: nowrap;
}
.filter-tag {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--blue-100);
    border: 1px solid #c9d4ff;
    border-radius: 100px;
    padding: 4px 6px 4px 10px;
    font-size: 12.5px; color: var(--ink-700);
    max-width: 320px;
}
.filter-tag-key {
    font-weight: 700; color: var(--blue-600); white-space: nowrap;
}
.filter-tag-key::after { content: ':'; margin-left: 1px; }
.filter-tag-val {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500;
}
.filter-tag-x {
    width: 20px; height: 20px; border: none; border-radius: 50%;
    background: transparent; color: var(--gray-500);
    font-size: 11px; line-height: 1; flex-shrink: 0;
}
.filter-tag-x:hover { background: #fff; color: var(--coral-500); }
.filter-tags-clear {
    border: none; background: transparent;
    color: var(--blue-600); font-size: 12.5px; font-weight: 600;
    padding: 4px 6px;
}
.filter-tags-clear:hover { text-decoration: underline; }
.stat-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid var(--border-default);
    border-radius: 100px; padding: 5px 11px;
    font-size: 12.5px; font-weight: 600; color: var(--ink-700);
    white-space: nowrap;
}
.stat-chip.active { font-weight: 700; }
.stat-chip:hover { filter: brightness(.96); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.orange { background: var(--orange-500); }

.btn-accent.topbar-create {
    height: 34px; padding: 0 14px; font-size: 13px;
    flex-shrink: 0;
}
/* ---------- Hàng ghim + sum trạng thái ---------- */
.meta-strip {
    background: var(--cream-100); border-bottom: 1px solid var(--border-subtle);
    padding: 7px 20px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    flex-shrink: 0; min-height: 42px;
}
.pin-strip-inner {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    min-width: 0;
}
.status-sum {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    justify-content: flex-end;
}
.tag-sum {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    min-width: 0; flex: 1 1 auto;
    max-width: 55%;
}
.stat-chip.tag-stat {
    border-color: var(--blue-200, #c7d2fe);
    color: var(--blue-600, #2563eb);
    background: #fff;
}
.stat-chip.tag-stat.active {
    background: var(--blue-600, #2563eb);
    color: #fff;
    border-color: var(--blue-600, #2563eb);
}
.pin-strip {
    background: var(--cream-100); border-bottom: 1px solid var(--border-subtle);
    padding: 7px 20px;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    flex-shrink: 0;
}
.pin-label { font-size: 12px; font-weight: 700; color: var(--ink-700); display: inline-flex; align-items: center; gap: 5px; }
.pin-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid var(--yellow-300);
    border-radius: 100px; padding: 3px 6px 3px 12px;
    font-size: 12.5px; color: var(--ink-700);
    cursor: pointer; white-space: nowrap;
    transition: border-color .15s;
}
.pin-chip:hover { border-color: var(--orange-500); }
.pin-chip b { color: var(--blue-600); white-space: nowrap; }
.pin-x {
    width: 16px; height: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: var(--surface-100); border-radius: 50%;
    color: var(--gray-500); font-size: 10px; padding: 0;
}
.pin-x:hover { background: #ffecea; color: var(--coral-500); }

/* ---------- Bảng ---------- */
.board { flex: 1; display: flex; overflow: hidden; position: relative; }
.table-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.table-scroll { flex: 1; overflow: auto; }
.ticket-table { width: 100%; min-width: 1260px; border-collapse: collapse; font-size: 13.5px; }
.ticket-table th {
    position: sticky; top: 0; z-index: 2;
    background: var(--surface-100);
    text-align: left; padding: 9px 14px;
    font-size: 11.5px; font-weight: 700; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: .5px; white-space: nowrap;
    border-bottom: 1px solid var(--border-default);
    border-right: 1px solid var(--border-default);
}
.ticket-table th.w-stt { width: 44px; text-align: center; padding: 9px 6px; }
.ticket-table th.w-ma { width: 100px; }
.ticket-table th.w-title { min-width: 250px; }
.ticket-table td.cell-title { min-width: 250px; max-width: 360px; }
.ticket-table th.w-files { width: 120px; min-width: 120px; }
.ticket-table td.cell-files {
    width: 120px; min-width: 120px; max-width: 120px;
    vertical-align: middle;
    white-space: normal;
    padding: 8px 6px;
}
.ticket-table th.w-loai { width: 92px; }
.ticket-table th.w-dap { width: 76px; text-align: center; padding: 9px 10px; }
.ticket-table th.w-status { width: 130px; }
.ticket-table th.w-uutien { width: 104px; }
.ticket-table th.w-nguoi { width: 88px; }
.ticket-table th.w-han { width: 84px; }
.ticket-table th.w-nguoi2 { width: 88px; font-size: 10.5px; padding: 8px 6px; }
.ticket-table th.w-donvi { width: 140px; }
.ticket-table th.w-ngay { width: 72px; font-size: 10px; padding: 8px 4px; }
.ticket-table th.w-capnhat { width: 72px; font-size: 10px; padding: 8px 4px; }
.ticket-table th.w-act { width: 44px; border-right: none; padding: 9px 6px; }
.ticket-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    white-space: nowrap;
}
.ticket-table td.cell-meta {
    font-size: 10.5px;
    line-height: 1.25;
    padding: 8px 4px;
    max-width: 88px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.ticket-table td.cell-datetime {
    font-size: 10px;
    line-height: 1.25;
    max-width: 72px;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
}
.ticket-table td.cell-datetime .dt-date,
.ticket-table td.cell-datetime .dt-time {
    display: block;
    white-space: nowrap;
}
.ticket-table td.cell-datetime .dt-time {
    color: var(--gray-500, #6b7280);
    font-size: 9.5px;
}
.ticket-table td:last-child { border-right: none; padding: 11px 6px; text-align: center; }
.ticket-table tbody tr { cursor: pointer; background: #fff; }
.ticket-table tbody tr:hover { background: var(--blue-100); }
.ticket-table tbody tr.selected { background: var(--blue-100); }
.cell-ma { font-weight: 700; color: var(--blue-600); }
.cell-stt {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500, #6b7280);
    padding-left: 6px !important;
    padding-right: 6px !important;
}
.cell-dap { text-align: center; cursor: default; }
.cell-dap input { width: 16px; height: 16px; accent-color: var(--blue-600); cursor: pointer; }
.pin-btn {
    width: 20px; height: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: transparent; padding: 0;
    color: var(--gray-300); vertical-align: middle; margin-right: 4px;
}
.pin-btn:hover { color: var(--orange-500); }
.pin-btn.on { color: var(--orange-500); }
.row-title {
    font-weight: 600; color: var(--ink-900); white-space: normal;
    display: flex; align-items: flex-start; gap: 8px;
}
.row-title-text { flex: 1 1 auto; min-width: 0; }
.row-cmt-btn {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 4px;
    height: 22px; padding: 0 7px;
    border: 1px solid var(--border-default, #e5e7eb);
    border-radius: 999px; background: #fff;
    color: var(--gray-500, #6b7280);
    font-size: 12px; font-weight: 600; line-height: 1;
    cursor: pointer;
}
.row-cmt-btn:hover {
    color: var(--blue-600, #2563eb);
    border-color: var(--blue-600, #2563eb);
    background: var(--blue-50, #eef2ff);
}
.row-desc {
    margin-top: 3px;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--gray-500, #6b7280);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    max-width: 340px;
}
.row-desc:hover { color: var(--blue-600, #2563eb); }
.row-files {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    width: 108px; /* 3 × 32px + 2 × 4px gap */
}
.file-thumb-btn {
    width: 32px; height: 32px; padding: 0; margin: 0;
    flex: 0 0 32px;
    border: 1px solid var(--border-default, #e5e7eb);
    border-radius: 6px; background: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    overflow: hidden; cursor: pointer; color: var(--gray-500, #6b7280);
}
.file-thumb-btn:hover { border-color: var(--blue-600); color: var(--blue-600); }
.file-thumb-btn img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.file-add-btn {
    width: 32px; height: 32px; padding: 0; margin: 0;
    flex: 0 0 32px;
    border: 1px dashed var(--border-default, #d1d5db);
    border-radius: 6px; background: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--gray-500, #6b7280);
}
.file-add-btn:hover:not(:disabled) {
    border-color: var(--blue-600); color: var(--blue-600);
    background: var(--blue-50, #eef2ff);
}
.file-add-btn:disabled { opacity: .5; cursor: not-allowed; }
.file-more { font-size: 11px; line-height: 32px; margin-left: 0; }
.row-tags { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.tag {
    background: var(--blue-100); color: var(--blue-600);
    font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 100px; white-space: nowrap;
}
.filecount { color: var(--gray-500); font-size: 11.5px; display: inline-flex; align-items: center; gap: 3px; }
.type-pill {
    display: inline-block; font-size: 12px; font-weight: 700;
    padding: 3px 10px; border-radius: 6px; white-space: nowrap;
}
.type-pill.req { background: var(--blue-100); color: var(--blue-600); }
.type-pill.bug { background: #ffecea; color: var(--coral-500); }
.status-pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 700;
    padding: 4px 11px; border-radius: 6px; white-space: nowrap;
    border: 1px solid transparent;
}
.ticket-table td.nowrap { white-space: nowrap; }
.status-pill .dot { width: 7px; height: 7px; }
.pr { font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.assignee { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
td.overdue { color: var(--coral-500); font-weight: 700; }
.del-btn {
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: transparent; border-radius: 8px;
    color: var(--gray-300);
}
.del-btn:hover { background: #ffecea; color: var(--coral-500); }
.empty { padding: 60px; text-align: center; color: var(--gray-500); font-size: 14px; }

/* ---------- Phân trang ---------- */
.pager {
    border-top: 1px solid var(--border-default);
    padding: 8px 16px;
    display: flex; align-items: center; gap: 6px;
    flex-shrink: 0; background: #fff;
}
.pager-info { font-size: 12.5px; color: var(--gray-500); white-space: nowrap; }
.pager-size {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; color: var(--gray-500); white-space: nowrap; margin-left: 10px;
}
.pager-size select {
    height: 30px; border: 1px solid var(--border-default); border-radius: 8px;
    padding: 0 8px; font-size: 12.5px; color: var(--ink-700); background: #fff; outline: none;
}
.pager button {
    min-width: 30px; height: 30px; padding: 0 12px;
    border: 1px solid var(--border-default); background: #fff;
    color: var(--ink-700); border-radius: 8px;
    font-size: 12.5px; font-weight: 600;
}
.pager button:hover { border-color: var(--blue-600); color: var(--blue-600); }
.pager button.active {
    background: var(--blue-600); border-color: var(--blue-600);
    color: #fff; font-weight: 700;
}
.pager button.ellipsis,
.pager button:disabled.ellipsis {
    min-width: 28px; padding: 0 6px;
    border-color: transparent; background: transparent;
    color: var(--gray-500); cursor: default;
    pointer-events: none;
}
.pager button:disabled:not(.ellipsis) {
    opacity: .45; cursor: default;
}

/* ---------- Panel chi tiết (overlay) ---------- */
.panel {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: 430px; z-index: 20;
    background: #fff; border-left: 1px solid var(--border-default);
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: -12px 0 32px rgba(26,51,129,.16);
}
.panel-head {
    padding: 14px 18px; border-bottom: 1px solid var(--border-subtle);
    display: flex; align-items: center; gap: 10px;
}
.panel-id { font-weight: 800; color: var(--blue-600); font-size: 14px; }
.panel-meta { font-size: 12px; color: var(--gray-500); }
.panel-body {
    flex: 1; overflow: auto; padding: 18px;
    display: flex; flex-direction: column; gap: 14px;
}
.panel-title {
    font-size: 17px; font-weight: 700; color: var(--ink-900);
    border: 1px solid transparent; border-radius: 8px;
    padding: 8px 10px; margin: -8px -10px 0; outline: none;
}
.panel-title:hover { border-color: var(--border-default); }
.panel-title:focus { border-color: var(--blue-600); }
.field-grid {
    display: grid; grid-template-columns: 110px 1fr;
    row-gap: 11px; align-items: center; font-size: 13.5px;
}
.field-grid label { color: var(--gray-500); }
.field-grid select, .field-grid input[type="date"] {
    height: 32px; border: 1px solid var(--border-default);
    border-radius: 8px; padding: 0 8px; font-size: 13px;
    background: #fff; outline: none; justify-self: start; min-width: 150px;
}
.field-grid .field-ac {
    min-width: 0; width: 100%; max-width: 320px; justify-self: stretch;
}
.field-grid .field-ac input {
    width: 100%; height: 32px; box-sizing: border-box;
    border: 1px solid var(--border-default); border-radius: 8px;
    padding: 0 10px; font-size: 13px; outline: none;
    color: var(--ink-700); background: #fff;
}
.field-grid .field-ac input:focus { border-color: var(--blue-600); }
.field-grid .field-ac .ac-list { top: 34px; z-index: 30; }
.deadline-picker {
    display: inline-flex; align-items: stretch; min-width: 190px;
    border: 1px solid var(--border-default); border-radius: 8px; background: #fff;
}
.deadline-picker input {
    width: 100%; min-width: 0; border: none; outline: none;
    padding: 0 10px; font-size: 13px; height: 32px; background: transparent;
}
.deadline-btn {
    width: 34px; border: none; border-left: 1px solid var(--border-default);
    background: transparent; color: var(--ink-700); display: inline-flex;
    align-items: center; justify-content: center; cursor: pointer; border-radius: 0 8px 8px 0;
}
.deadline-btn:hover { background: var(--surface-100); }
.deadline-btn:disabled { opacity: .55; cursor: not-allowed; }
.field-grid select:disabled,
.field-grid input:disabled,
.cell-dap input:disabled,
.check-line input:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background: #f3f4f6;
}
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-700); }
.check-line input { width: 16px; height: 16px; accent-color: var(--blue-600); cursor: pointer; }
.tag-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }
.tag-ac { position: relative; display: inline-block; }
.tag-ac .ac-list {
    left: 0; right: auto; min-width: 180px; max-width: 280px;
    z-index: 30;
}
.tag-ac-hint {
    position: absolute; left: 0; top: 100%;
    margin-top: 4px; padding: 6px 10px;
    background: #fff; border: 1px solid var(--border-default);
    border-radius: 8px; font-size: 12px; white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0,0,0,.1); z-index: 30;
}
.tag.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px 3px 10px; font-size: 12px; }
.tag.chip:hover { background: var(--blue-200); }
.tag-x {
    width: 15px; height: 15px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: transparent; border-radius: 50%;
    color: var(--blue-600); font-size: 10px; padding: 0;
    opacity: .35; transition: opacity .12s;
}
.tag-x:hover { opacity: 1; background: rgba(32,65,180,.15); }
.tag-input {
    height: 26px; width: 150px;
    border: 1px solid var(--blue-600); border-radius: 100px;
    padding: 0 12px; font-size: 12px; outline: none;
}
.tag-add {
    width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px dashed var(--gray-300); background: #fff; border-radius: 50%;
    color: var(--gray-500); font-size: 14px; line-height: 1; padding: 0;
}
.tag-add:hover { border-color: var(--blue-600); color: var(--blue-600); }
.section-label {
    font-size: 12px; font-weight: 700; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: .5px;
}
.panel-body textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border-default); border-radius: 8px;
    padding: 10px; font-size: 13.5px; line-height: 1.55;
    resize: vertical; outline: none; color: var(--ink-700);
}
.panel-body textarea:focus { border-color: var(--blue-600); }
.panel-body textarea.desc-area-create {
    min-height: 280px;
    height: 38vh;
    flex: 1 1 auto;
    align-self: stretch;
    min-width: 0;
}
.desc-block .desc-area {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.file-row {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface-100); border-radius: 8px;
    padding: 8px 12px; font-size: 13px;
}
.file-row.clickable { cursor: pointer; }
.file-row.clickable:hover { background: var(--blue-50, #eef2ff); }
.file-thumb {
    width: 36px; height: 36px; border-radius: 6px; overflow: hidden;
    flex-shrink: 0; background: #e5e7eb;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-name { flex: 1; font-weight: 600; color: var(--blue-600); min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-hint { font-size: 11.5px; flex-shrink: 0; }
.file-del-btn {
    width: 26px; height: 26px; margin-left: auto; flex-shrink: 0;
    border: none; border-radius: 6px; background: transparent;
    color: var(--gray-400, #9ca3af); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; line-height: 1;
}
.file-del-btn:hover:not(:disabled) { background: #ffecea; color: var(--coral-500, #ef4444); }
.file-del-btn:disabled { opacity: .5; cursor: not-allowed; }
.img-preview-backdrop { z-index: 1200; display: flex; align-items: center; justify-content: center; }
.img-preview-modal {
    width: min(920px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    background: #111827; border-radius: 12px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.img-preview-head {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: rgba(255,255,255,.06);
    color: #fff;
}
.img-preview-name {
    font-size: 13.5px; font-weight: 600;
    max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.img-preview-head .btn-muted.sm {
    height: 28px; padding: 0 10px; font-size: 12px;
    background: rgba(255,255,255,.12); color: #fff; border: none;
}
.img-preview-head .btn-muted.sm:hover { background: rgba(255,255,255,.22); }
.img-preview-head .icon-btn {
    background: rgba(255,255,255,.14);
    color: #fff;
    border: 1px solid rgba(255,255,255,.25);
    font-size: 16px; font-weight: 700; line-height: 1;
}
.img-preview-head .icon-btn:hover {
    background: rgba(255,255,255,.28);
    color: #fff;
}
.img-preview-body {
    flex: 1; min-height: 0; padding: 16px;
    display: flex; align-items: center; justify-content: center;
    overflow: auto;
}
.img-preview-body img {
    max-width: 100%; max-height: calc(100vh - 140px);
    object-fit: contain; border-radius: 4px;
}
.comment { display: flex; gap: 10px; margin-top: 10px; }
.comment-bubble {
    flex: 1; min-width: 0;
    background: var(--surface-100);
    border-radius: 0 12px 12px 12px; padding: 9px 12px;
}
.comment-head { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.comment-head .muted { font-size: 11px; }
.comment-del-btn {
    margin-left: auto;
    width: 22px; height: 22px; padding: 0;
    border: none; background: transparent; border-radius: 4px;
    color: var(--gray-400, #9ca3af); cursor: pointer;
    font-size: 12px; line-height: 1; flex-shrink: 0;
}
.comment-del-btn:hover { background: #ffecea; color: var(--coral-500, #ef4444); }
.modal.modal-comments { width: 520px; max-width: calc(100vw - 32px); }
.comment-popup-list {
    max-height: 360px; overflow: auto;
    margin: 0 0 12px; padding: 4px 2px 8px;
    border-bottom: 1px solid var(--border-subtle, #e5e7eb);
}
.comment-popup-list .comment:first-child { margin-top: 0; }
.comment-popup-compose {
    display: flex; gap: 8px; align-items: center; margin-bottom: 12px;
}
.comment-popup-compose input {
    flex: 1; min-width: 0; height: 38px;
    border: 1px solid var(--border-default); border-radius: 8px;
    padding: 0 12px; font-size: 13.5px; outline: none;
}
.comment-popup-compose input:focus { border-color: var(--blue-600); }
.comment-text {
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
}
.comment-file {
    margin-top: 6px; font-size: 12.5px; color: var(--blue-600);
    font-weight: 600; display: flex; align-items: center; gap: 5px;
}
.panel-foot {
    border-top: 1px solid var(--border-subtle);
    padding: 12px 18px;
    display: flex; gap: 8px; align-items: center;
}
.panel-foot input[type="text"] {
    flex: 1; height: 38px;
    border: 1px solid var(--border-default); border-radius: 100px;
    padding: 0 16px; font-size: 13.5px; outline: none;
}
.panel-foot input[type="text"]:focus { border-color: var(--blue-600); }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(20,25,58,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 50;
}
.modal {
    width: 480px; background: #fff; border-radius: 15px;
    box-shadow: 0 8px 28px rgba(26,51,129,.25);
    padding: 24px;
    display: flex; flex-direction: column; gap: 14px;
}
.modal h2 { font-size: 19px; font-weight: 800; margin: 0; }
.modal p { font-size: 13.5px; color: var(--ink-700); line-height: 1.55; margin: 0; }
.share-row { display: flex; gap: 8px; }
.share-row input {
    flex: 1; height: 40px;
    border: 1px solid var(--border-default); border-radius: 8px;
    padding: 0 12px; font-size: 13px; color: var(--ink-700);
    background: var(--surface-100); outline: none;
}
.share-note {
    display: flex; align-items: center; gap: 8px;
    background: var(--cream-100); border-radius: 8px;
    padding: 10px 14px; font-size: 12.5px; color: var(--ink-700);
}
.modal-foot { display: flex; justify-content: space-between; align-items: center; }
.modal-foot a { font-size: 13px; font-weight: 600; }
