/* HNV-IMS — Hanoi Voyages brand: navy #0E1C36 + gold #FAA61F (sampled from the logo) */
:root {
  --navy: #0e1c36;
  --navy-800: #16284a;
  --navy-700: #1f3560;
  --navy-100: #e7ebf3;
  --navy-50: #f3f5f9;
  --gold: #faa61f;
  --gold-600: #e08e05;
  --gold-100: #fff1d9;
  --gold-50: #fff8ec;

  --bg: #f5f6f9;
  --surface: #ffffff;
  --text: #0e1c36;
  --muted: #5b6780;
  --faint: #8a94a8;
  --border: #dfe3eb;
  --border-strong: #c7cedb;

  --red: #c62828;  --red-bg: #fdecec;
  --amber: #a15c00; --amber-bg: #fff3dc;
  --green: #1e7d4f; --green-bg: #e5f5ec;
  --blue: #1f5fbf; --blue-bg: #e8f0fc;
  --violet: #6b3fa0; --violet-bg: #f1eafa;
  --grey-bg: #eef0f4;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(14, 28, 54, .06), 0 2px 8px rgba(14, 28, 54, .05);
  --shadow-lg: 0 12px 40px rgba(14, 28, 54, .18);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sidebar: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--navy-700); text-decoration: none; }
a:hover { color: var(--gold-600); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .6em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #cfd6e4; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { width: 100%; max-width: 180px; display: block; }
.sidebar .brand small { display: block; margin-top: 6px; color: var(--gold); font-weight: 600; letter-spacing: .08em; font-size: 11px; text-transform: uppercase; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #cfd6e4; font-weight: 500; }
.nav a:hover { background: var(--navy-800); color: #fff; text-decoration: none; }
.nav a.active { background: var(--navy-700); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav a .count { margin-left: auto; background: var(--gold); color: var(--navy); border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 7px; }
.nav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 10px 4px; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.sidebar .foot { padding: 12px 18px; font-size: 11.5px; color: #8b96ad; border-top: 1px solid rgba(255,255,255,.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: center; padding: 10px 24px; }
.topbar .search { flex: 1; max-width: 560px; position: relative; }
.topbar .search input { width: 100%; padding-left: 36px; background: var(--navy-50); border-color: transparent; }
.topbar .search input:focus { background: #fff; border-color: var(--border-strong); }
.topbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.topbar .spacer { flex: 1; }
.usermenu { position: relative; }
.usermenu > button { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid transparent; padding: 4px 8px; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; }
.usermenu > button:hover { background: var(--navy-50); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--gold); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 30; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu .who small { color: var(--muted); display: block; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; color: var(--text); cursor: pointer; }
.menu button:hover { background: var(--navy-50); }

.content { padding: 22px 24px 48px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 260px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card > .card-head h2, .card > .card-head h3 { flex: 1; }
.card > .card-body { padding: 16px; }
.card > details > summary.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; }
.card > details > summary.card-head::-webkit-details-marker { display: none; }
.card > details > summary.card-head h2 { flex: 1; }
.card > details > summary.card-head::after { content: "▸"; color: var(--faint); transition: transform .15s; }
.card > details[open] > summary.card-head { border-bottom: 1px solid var(--border); }
.card > details[open] > summary.card-head::after { transform: rotate(90deg); }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid > .card + .card, .two-col > .card + .card { margin-top: 0; } /* side by side: no stacking gap */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.stack > * + * { margin-top: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { display: block; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: var(--text); position: relative; overflow: hidden; }
.stat:hover { text-decoration: none; border-color: var(--gold); color: var(--text); }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent, var(--navy)); }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat.warn { --accent: var(--gold); }
.stat.danger { --accent: var(--red); }
.stat.info { --accent: var(--blue); }
.stat.ok { --accent: var(--green); }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
label .req { color: var(--red); }
label .hint, .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=url], input[type=search], input[type=password], input[type=email], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 10px; transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
textarea.tall { min-height: 220px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-100); }
.field { margin-bottom: 14px; }
.field .err { color: var(--red); font-size: 12.5px; margin-top: 4px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 500; }
details.more { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 10px 14px; margin: 6px 0 14px; background: var(--navy-50); }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--navy-700); }
details.more[open] > summary { margin-bottom: 12px; }

.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: #fff; color: var(--text); padding: 7px 14px; cursor: pointer; white-space: nowrap; line-height: 1.4; }
.btn:hover { background: var(--navy-50); text-decoration: none; color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn.primary:hover { background: var(--gold-600); border-color: var(--gold-600); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.dark:hover { background: var(--navy-700); }
.btn.danger { color: var(--red); border-color: #efc4c4; }
.btn.danger:hover { background: var(--red-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--navy-50); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn svg { width: 16px; height: 16px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--navy-700); font: inherit; cursor: pointer; }
.linkbtn:hover { color: var(--gold-600); text-decoration: underline; }

/* ---------- badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--grey-bg); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.st-open { background: var(--blue-bg); color: var(--blue); }
.st-in_progress { background: var(--gold-100); color: var(--amber); }
.st-waiting { background: var(--violet-bg); color: var(--violet); }
.st-resolved { background: var(--green-bg); color: var(--green); }
.pr-high { background: var(--red-bg); color: var(--red); }
.pr-normal { background: var(--grey-bg); color: var(--muted); }
.pr-low { background: #f4f6f8; color: var(--faint); }
.ks-draft { background: var(--grey-bg); color: var(--muted); }
.ks-pending_approval { background: var(--gold-100); color: var(--amber); }
.ks-published { background: var(--green-bg); color: var(--green); }
.ks-archived { background: #f1f1f1; color: #777; }
.type { font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--navy-700); background: var(--navy-100); padding: 2px 8px; border-radius: 4px; }
.ref { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12px; background: var(--gold-50); border: 1px solid #f6d79f; color: var(--navy); padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.ref b { font-family: var(--font); font-size: 10.5px; font-weight: 700; color: var(--gold-600); }
.ref button { border: 0; background: none; cursor: pointer; color: var(--faint); padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.ref button:hover { color: var(--red); }
.refs { display: flex; gap: 4px; flex-wrap: wrap; }
.key { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.overdue { color: var(--red); font-weight: 600; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs a, .tabs button { padding: 9px 14px; color: var(--muted); font-weight: 600; border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .active { color: var(--navy); border-bottom-color: var(--gold); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border-strong); background: #fff; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- tables & lists ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--navy-50); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfd; }
.table .title a { color: var(--text); font-weight: 600; }
.table .title a:hover { color: var(--gold-600); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); background: #fcfcfd; }
.filters > * { width: auto; min-width: 140px; }
.filters input[type=search] { min-width: 220px; flex: 1; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 16px; color: var(--muted); font-size: 13px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; }
.list .meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; align-items: center; }
.empty { padding: 28px 16px; text-align: center; color: var(--faint); }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- issue detail ---------- */
.prose { overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 1em 0 .4em; }
.prose h1 { font-size: 20px; } .prose h2 { font-size: 17px; } .prose h3 { font-size: 15px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 .7em; }
.prose li { margin: 2px 0; }
.prose li.task { list-style: none; margin-left: -20px; }
.prose pre { background: var(--navy-50); padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
.prose blockquote { margin: 0 0 .7em; padding: 4px 12px; border-left: 3px solid var(--gold); color: var(--muted); background: var(--gold-50); }
.prose > :first-child { margin-top: 0; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .bubble { flex: 1; min-width: 0; }
.timeline .who { font-weight: 600; }
.timeline .when { color: var(--faint); font-size: 12px; margin-left: 6px; }
.activity { font-size: 12.5px; color: var(--muted); }
.activity li { padding: 6px 0; display: block; border-bottom: 1px dashed var(--border); }

.callout { border-radius: var(--radius-sm); padding: 10px 14px; border: 1px solid; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.callout svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.callout.info { background: var(--blue-bg); border-color: #c5d8f5; color: #183f7a; }
.callout.warn { background: var(--gold-50); border-color: #f6d79f; color: #6b4300; }
.callout.danger { background: var(--red-bg); border-color: #f3c0c0; color: #8a1c1c; }
.callout.ok { background: var(--green-bg); border-color: #b9e2cb; color: #155c3a; }
.callout + .callout { margin-top: 8px; }

.status-actions { display: flex; flex-direction: column; gap: 8px; }
.status-actions .btn { justify-content: center; }
.side .card-body > * + * { margin-top: 12px; }

/* SOP reading layout */
.sop-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; }
.sop-section { padding: 14px 0; border-bottom: 1px solid var(--border); }
.sop-section:last-child { border-bottom: 0; }
.sop-section h3 { color: var(--navy-700); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.sop-code { white-space: nowrap; font-family: var(--mono); background: var(--navy); color: var(--gold); padding: 3px 10px; border-radius: 5px; font-size: 13px; font-weight: 600; }

/* ---------- dialog / toast ---------- */
dialog { border: 0; border-radius: 12px; padding: 0; box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); color: var(--text); }
dialog::backdrop { background: rgba(14, 28, 54, .45); }
dialog.wide { width: min(980px, calc(100vw - 32px)); }
dialog.xwide { width: min(1280px, calc(100vw - 32px)); }
dialog.xwide .dlg-body { max-height: calc(100vh - 160px); overflow: auto; }
dialog.xwide .fb-row.with-route { grid-template-columns: 170px minmax(0, 1.3fr) minmax(0, 1.4fr) 150px auto; }
@media (max-width: 760px) { dialog.xwide .fb-row.with-route { grid-template-columns: 1fr; } }
.sync-list { max-height: 55vh; overflow: auto; }
dialog .dlg-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
dialog .dlg-head h2 { flex: 1; }
dialog .dlg-body { padding: 18px 20px; }
dialog .dlg-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--navy-50); border-radius: 0 0 12px 12px; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 380px; border-left: 4px solid var(--gold); font-size: 13.5px; }
.toast.error { border-left-color: #ff6b6b; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--navy); color: #cfd6e4; display: flex; flex-direction: column; justify-content: center; padding: 56px; position: relative; overflow: hidden; }
.login-art img { width: 280px; max-width: 80%; }
.login-art h1 { color: #fff; font-size: 28px; margin: 36px 0 10px; }
.login-art p { max-width: 440px; font-size: 15px; }
.login-art .gold { color: var(--gold); }
.login-art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 50%; border: 40px solid rgba(250, 166, 31, .12); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--surface); }
.login-form form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 22px; margin-bottom: 4px; }
.login-form .sub { color: var(--muted); margin-bottom: 24px; }
.login-form .btn { width: 100%; justify-content: center; padding: 10px; margin-top: 6px; }

.loading { padding: 40px; text-align: center; color: var(--faint); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }

@media (max-width: 1080px) {
  .detail-grid { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav .sep, .sidebar .foot, .sidebar .brand small { display: none; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { padding: 32px; }
  .login-art h1 { font-size: 22px; margin-top: 20px; }
}

/* iToursys */
.itoursys-tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: #2a6db0; padding: 1px 7px; border-radius: 4px; vertical-align: middle; }
.ext-ico { font-size: 11px; opacity: .8; }
.nav .group { padding: 4px 12px 2px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #8b96ad; font-weight: 700; }
.nav a.ext { color: #cfd6e4; font-weight: 500; }
.boundary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.boundary > div { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: #fff; }
.boundary > div.here { border-color: var(--gold); background: var(--gold-50); }
.boundary h3 { font-size: 14px; margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.boundary p { color: var(--muted); font-size: 13px; margin: 0; }
.matrix td.yes { color: var(--green); font-weight: 600; }
.matrix td.no { color: var(--faint); }
.matrix td.cond { color: var(--amber); font-weight: 600; font-size: 12.5px; }
.matrix th:not(:first-child), .matrix td:not(:first-child) { text-align: center; width: 150px; }
.role-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .boundary, .role-cards { grid-template-columns: 1fr; } }

/* utility classes (inline style attributes are blocked by the CSP) */
.w-type { width: 170px; flex: none; }
.w-label { width: 110px; flex: none; }
.grow-input { flex: 1; min-width: 180px; }
.m0 { margin: 0 !important; }
.tight { gap: 2px; }
.end { justify-content: flex-end; }
.form-foot { border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.top-line { border-top: 1px solid var(--border); }
.link-form { padding: 12px 16px; border-top: 1px solid var(--border); }
.pad-x { padding: 0 16px 16px; }
.preview { padding: 16px; margin-bottom: 14px; background: var(--navy-50); }
.center-self { align-self: center; }

/* code chip: link to filtered list + iToursys record icon */
.ref a.ref-code { color: inherit; text-decoration: none; }
.ref a.ref-code:hover { color: var(--gold-600); text-decoration: underline; }
.ref a.ref-ext { display: inline-flex; color: #2a6db0; margin-left: 2px; }
.ref a.ref-ext:hover { color: var(--gold-600); }
.ref a.ref-ext svg { width: 13px; height: 13px; }
.lookup { font-size: 11.5px; color: var(--faint); }
.lookup.warn { color: var(--amber); }
.lookup .linkbtn svg { width: 12px; height: 12px; vertical-align: -1px; }

/* narrow screens: the horizontal nav scrolls inside itself instead of widening the page */
@media (max-width: 760px) {
  .shell > * { min-width: 0; }
  .sidebar { max-width: 100vw; overflow: hidden; }
  .nav a { flex: none; }
  .nav .group { display: none; }
}
.ref .ref-miss { display: inline-flex; align-items: center; color: var(--red); background: none; border: 0; padding: 0 0 0 2px; cursor: default; font-size: 0; }
.ref button.ref-miss { cursor: pointer; }
.ref button.ref-miss:hover { color: #8a1c1c; }
.ref .ref-miss svg { width: 12px; height: 12px; stroke-width: 2.6; }
.type.type-trouble { background: var(--red-bg); color: var(--red); }
.ref .ref-miss svg { width: 13px; height: 13px; stroke-width: 2.2; }
.ref .ref-miss svg { width: 14px; height: 14px; stroke-width: 2.4; }

/* collaborators picker */
.user-picker { display: flex; flex-direction: column; gap: 6px; }
.user-picker .refs:empty { display: none; }
.ref.user-chip { font-family: var(--font); font-size: 12.5px; background: var(--navy-50); border-color: var(--border); gap: 6px; padding: 2px 6px 2px 2px; }
.ref.user-chip .avatar.sm { width: 18px; height: 18px; font-size: 9px; }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(240px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: var(--navy-50); border: 1px solid var(--border); border-radius: var(--radius); min-height: 200px; display: flex; flex-direction: column; transition: background .12s, border-color .12s; }
.board-col.drop-target { background: var(--gold-50); border-color: var(--gold); border-style: dashed; }
.board-col-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.board-count { margin-left: auto; font-weight: 700; color: var(--muted); font-size: 12.5px; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; }
.board-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.board-empty { color: var(--faint); text-align: center; padding: 18px 0; font-size: 13px; }
.board-more { margin: 4px 10px 12px; align-self: stretch; }
.board-more[hidden] { display: none; }
.board-card { background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 10px; box-shadow: var(--shadow); cursor: grab; display: flex; flex-direction: column; gap: 6px; }
.board-card:hover { border-color: var(--gold); }
.board-card.dragging { opacity: .45; }
.board-card.prio-high { border-left-color: var(--red); }
.board-card.is-overdue { background: #fffafa; }
.board-card-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.board-card-title { color: var(--text); font-weight: 600; line-height: 1.35; }
.board-card-title:hover { color: var(--gold-600); }
.board-card-foot { display: flex; align-items: center; gap: 6px; }
.grow { flex: 1; }
.board-filters { border-bottom: 0; }
.view-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.view-switch a { padding: 7px 12px; font-weight: 600; color: var(--muted); background: #fff; }
.view-switch a.active { background: var(--navy); color: #fff; }
.view-switch a:hover { text-decoration: none; }
@media (max-width: 1080px) { .board { grid-template-columns: repeat(var(--cols, 4), 260px); } }
.people-row { align-items: start; }

/* attachments: album + file list + drop zone + lightbox */
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.album-sm { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); margin-top: 10px; }
.album-sm:empty { display: none; }
.thumb { position: relative; margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.thumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--navy-50); }
.thumb-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.thumb-open:hover img { opacity: .9; }
.thumb figcaption { font-size: 11.5px; color: var(--muted); padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(14, 28, 54, .7); color: #fff; cursor: pointer; line-height: 1; font-size: 15px; }
.thumb-del:hover { background: var(--red); }
.thumb-file { display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 4 / 3.6; padding-top: 10px; }
.file-icon { flex: none; position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 40px; height: 46px; border-radius: 6px; background: var(--navy-50); border: 1px solid var(--border); color: var(--navy-700); }
.file-icon svg { width: 16px; height: 16px; }
.file-icon b { font-size: 9px; letter-spacing: .02em; margin-top: 2px; }
.file-icon.fi-pdf { background: #fdecec; color: #b42318; border-color: #f3c0c0; }
.file-icon.fi-doc { background: #e8f0fc; color: #1f5fbf; border-color: #c5d8f5; }
.file-icon.fi-xls { background: #e5f5ec; color: #1e7d4f; border-color: #b9e2cb; }
.file-icon.fi-ppt { background: #fff1e6; color: #c2410c; border-color: #fed7aa; }
.file-list li { align-items: center; padding-left: 0; padding-right: 0; }
.drop-zone { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px; color: var(--muted); background: var(--navy-50); }
.drop-zone svg { width: 16px; height: 16px; }
.drop-zone.over { border-color: var(--gold); background: var(--gold-50); color: var(--text); }
dialog.lightbox { width: min(1100px, calc(100vw - 32px)); background: #0b1426; color: #fff; padding: 0; }
dialog.lightbox::backdrop { background: rgba(5, 10, 20, .8); }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 13px; }
.lb-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 300px; padding: 0 56px 16px; }
.lb-img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 4px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 30px; cursor: pointer; }
.lb-nav:hover { background: var(--gold); color: var(--navy); }
.lb-nav.prev { left: 8px; }
.lb-nav.next { right: 8px; }
.card-head h2 svg, .card-head h3 svg { width: 17px; height: 17px; vertical-align: -3px; color: var(--muted); }

/* brand: smaller logo, flower mark where space is tight */
.sidebar .brand { display: block; padding: 14px 18px 12px; text-decoration: none; }
.sidebar .brand:hover { text-decoration: none; }
.sidebar .brand img.brand-logo { width: 128px; max-width: 128px; }
.sidebar .brand .brand-mark { display: none; }
.sidebar .brand small { margin-top: 4px; font-size: 10px; }
.login-art img { width: 190px; max-width: 70%; }
.login-art h1 { margin-top: 28px; }
.login-mark { display: block; margin-bottom: 12px; }
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--faint); }
.boot img { animation: hnv-spin 2.4s linear infinite; }
.loading { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.loading img.spin { animation: hnv-spin 2.4s linear infinite; opacity: .9; }
.empty-mark { display: block; margin: 0 auto 8px; opacity: .55; }
@keyframes hnv-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .boot img, .loading img.spin { animation: none; } }
@media (max-width: 760px) {
  .sidebar .brand { display: flex; align-items: center; padding: 10px 16px; }
  .sidebar .brand img.brand-logo { display: none; }
  .sidebar .brand .brand-mark { display: block; width: 32px; height: 32px; max-width: none; }
}

/* Markdown editor */
.md-editor { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; }
.md-editor:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-100); }
.md-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 6px; border-bottom: 1px solid var(--border); background: var(--navy-50); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.md-tabs { display: flex; gap: 2px; margin-right: 4px; }
.md-tab { border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.md-tab.active { background: #fff; color: var(--navy); box-shadow: 0 0 0 1px var(--border); }
.md-tools { display: flex; gap: 1px; flex-wrap: wrap; align-items: center; }
.md-btn { min-width: 26px; height: 26px; border: 0; background: none; border-radius: 4px; cursor: pointer; font: inherit; font-size: 13px; color: var(--navy-700); padding: 0 5px; }
.md-btn:hover { background: #fff; color: var(--gold-600); }
.md-btn.md-b { font-weight: 800; }
.md-btn.md-i { font-style: italic; font-family: Georgia, serif; }
.md-btn.md-s { text-decoration: line-through; }
.md-sep { width: 1px; height: 16px; background: var(--border-strong); margin: 0 4px; }
.md-hint { margin-left: auto; font-size: 11px; color: var(--faint); cursor: help; border-bottom: 1px dotted var(--faint); }
.md-editor textarea.md-input { border: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); box-shadow: none; resize: vertical; font-family: var(--font); }
.md-editor textarea.md-input:focus { box-shadow: none; }
.md-preview { padding: 10px 12px; }
.field.invalid .md-editor { border-color: var(--red); }
.prose .md-table { border-collapse: collapse; margin: 0 0 .8em; min-width: 50%; }
.prose .md-table th, .prose .md-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose .md-table th { background: var(--navy-50); font-weight: 650; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.prose del { color: var(--muted); }

/* Mermaid diagrams */
.diagram { margin: 0 0 .9em; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; padding: 12px; overflow-x: auto; text-align: center; }
.diagram-open { border: 0; background: none; padding: 0; cursor: zoom-in; max-width: 100%; }
.diagram img { max-width: 100%; height: auto; }
.diagram-loading { color: var(--faint); font-size: 13px; padding: 20px 0; }
.diagram-error { color: var(--red); font-size: 13px; text-align: left; margin-bottom: 6px; }
.diagram pre { text-align: left; }
.diagram-view .diagram-full { background: #fff; overflow: auto; max-height: 82vh; padding: 16px; text-align: center; }
.diagram-view .diagram-full img { max-width: none; }

/* ---------- Visual Markdown editor (Milkdown Crepe, assets/vendor/milkdown) ---------- */
.md-visual { position: relative; }
.md-visual textarea.md-source { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; resize: none; border: 0; padding: 0; }
.md-loading { padding: 12px 14px; color: var(--faint); font-size: 13px; min-height: 96px; }
.md-visual .milkdown {
  --crepe-color-background: #fff;
  --crepe-color-on-background: var(--text);
  --crepe-color-surface: var(--navy-50);
  --crepe-color-surface-low: var(--navy-50);
  --crepe-color-on-surface: var(--text);
  --crepe-color-on-surface-variant: var(--muted);
  --crepe-color-outline: var(--border-strong);
  --crepe-color-primary: var(--gold-600);
  --crepe-color-secondary: var(--gold-100);
  --crepe-color-on-secondary: var(--navy);
  --crepe-color-inverse: var(--navy);
  --crepe-color-on-inverse: #fff;
  --crepe-color-inline-code: #a8322b;
  --crepe-color-error: var(--red);
  --crepe-color-hover: var(--navy-100);
  --crepe-color-selected: var(--gold-100);
  --crepe-color-inline-area: var(--navy-50);
  --crepe-base-font-size: 14px;
  --crepe-font-title: var(--font);
  --crepe-font-default: var(--font);
  --crepe-font-code: var(--mono);
  --crepe-shadow-1: var(--shadow);
  --crepe-shadow-2: var(--shadow-lg);
  border-radius: var(--radius-sm);
  background: #fff;
}
.md-visual .milkdown .ProseMirror { padding: 10px 16px 14px 40px; min-height: 110px; max-height: 70vh; overflow-y: auto; line-height: 1.6; }
.md-visual .milkdown .milkdown-top-bar { border-radius: var(--radius-sm) var(--radius-sm) 0 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.md-visual .milkdown .ProseMirror h1 { font-size: 1.6em; margin: .4em 0 .2em; }
.md-visual .milkdown .ProseMirror h2 { font-size: 1.35em; margin: .4em 0 .2em; }
.md-visual .milkdown .ProseMirror h3 { font-size: 1.15em; margin: .4em 0 .2em; }
.md-visual .milkdown .ProseMirror p { padding: 1px 0; }
.md-visual .milkdown .milkdown-code-block .preview .diagram { margin: 0; }
textarea.tall + .md-root .milkdown .ProseMirror, .md-visual:has(textarea.tall) .milkdown .ProseMirror { min-height: 260px; }
/* full-window editing (top-bar button) */
.md-visual.md-full { position: fixed; inset: 0; z-index: 1000; background: var(--bg); border: 0; border-radius: 0; box-shadow: none; overflow: auto; }
.md-visual.md-full .milkdown { max-width: 1040px; margin: 0 auto; min-height: 100%; border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-radius: 0; }
.md-visual.md-full .milkdown .ProseMirror { max-height: none; min-height: calc(100vh - 100px); padding: 24px 48px 48px 64px; font-size: 15px; }
html.md-full-open, html.md-full-open body { overflow: hidden; }

/* ---------- Notifications: bell, panel, top-corner pop-ups ---------- */
.bell-wrap { position: relative; }
.bell { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 50%; background: none; color: var(--navy-700); cursor: pointer; }
.bell:hover, .bell[aria-expanded="true"] { background: var(--navy-50); }
.bell svg { width: 21px; height: 21px; }
.bell-badge { position: absolute; top: 2px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.notif-panel { position: absolute; right: -60px; top: calc(100% + 8px); width: min(400px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 40; display: flex; flex-direction: column; max-height: min(640px, calc(100vh - 80px)); }
.notif-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 6px; }
.notif-head strong { font-size: 15px; }
.link-btn { border: 0; background: none; color: var(--navy-700); font: inherit; font-size: 12.5px; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.link-btn:hover { color: var(--gold-600); text-decoration: underline; }
.notif-tabs { display: flex; gap: 4px; padding: 2px 12px 8px; border-bottom: 1px solid var(--border); }
.notif-tab { border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 10px; border-radius: 14px; cursor: pointer; }
.notif-tab.active { background: var(--navy); color: #fff; }
.notif-list { overflow-y: auto; flex: 1; min-height: 80px; }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--faint); }
.notif-item { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: none; padding: 10px 14px; cursor: pointer; font: inherit; color: var(--text); }
.notif-item:hover { background: var(--navy-50); }
.notif-item .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: transparent; }
.notif-item.unread { background: var(--gold-50); }
.notif-item.unread:hover { background: var(--gold-100); }
.notif-item.unread .dot { background: var(--gold); }
.notif-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-main .t { font-weight: 600; font-size: 13.5px; }
.notif-item:not(.unread) .notif-main .t { font-weight: 500; }
.notif-main .b { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-main .when { color: var(--faint); font-size: 11.5px; }
.notif-pager { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.notif-settings { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px 12px; background: var(--navy-50); border-radius: 0 0 var(--radius) var(--radius); }
.notif-opt { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.notif-opt small { color: var(--muted); }
.notif-opt svg { width: 15px; height: 15px; flex: none; }
.notif-opt.muted { color: var(--muted); font-size: 12.5px; }
.notif-settings .btn svg { width: 15px; height: 15px; }
.notif-pops { position: fixed; top: 64px; right: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.notif-pop { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--gold); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px 10px 10px 12px; cursor: pointer; animation: notif-in .25s ease-out; }
.notif-pop:hover { background: var(--gold-50); }
.notif-pop-icon { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--gold); display: grid; place-items: center; }
.notif-pop-icon svg { width: 16px; height: 16px; }
.notif-pop-main { flex: 1; min-width: 0; }
.notif-pop-main .t { font-weight: 600; font-size: 13.5px; }
.notif-pop-main .b { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-pop-close { flex: none; border: 0; background: none; color: var(--faint); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.notif-pop-close:hover { color: var(--text); }
@keyframes notif-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .notif-panel { position: fixed; right: 12px; left: 12px; top: 58px; width: auto; } }

/* ---------- Knowledge: business area + MODULE ---------- */
.meta .area { color: var(--navy-700); font-weight: 600; }
.type.type-module { background: var(--gold-100); color: #8a5400; }
.module-card .card-head .ref { margin-left: auto; }
.module-fields { border: 1px dashed var(--gold); border-radius: var(--radius-sm); padding: 12px 14px 4px; margin-bottom: 14px; background: var(--gold-50); }
.field-wrap { flex: 1; min-width: 0; }
.field-wrap > .small { margin: -8px 0 12px; }
td.nowrap { white-space: nowrap; }

/* ---------- Customer feedback ---------- */
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stars { color: var(--gold-600); letter-spacing: 1px; }
.stars.big { font-size: 18px; }
.vote { font-size: 16px; }
.fb-items li { align-items: flex-start; }
.fb-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.fb-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 130px minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.fb-row input[hidden], .fb-row select[hidden] { display: none; }
dialog .fb-row { grid-template-columns: 150px minmax(0, 1fr) 150px auto; }
.fb-row .invisible { visibility: hidden; }
@media (max-width: 760px) { .fb-row, dialog .fb-row { grid-template-columns: 1fr; } }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .link-grid { grid-template-columns: 1fr; } }
.link-body { display: flex; gap: 14px; align-items: flex-start; }
.qr { flex: none; width: 168px; min-height: 168px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.qr img { display: block; width: 168px; height: 168px; image-rendering: pixelated; }
.svc { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.link-url { margin-top: 10px; }
.link-url input { width: 100%; font-size: 12px; }
.link-card .form-foot { flex-wrap: wrap; justify-content: flex-start; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
blockquote.prewrap { margin: 0; padding: 10px 14px; border-left: 3px solid var(--gold); background: var(--gold-50); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--gold); background: var(--gold-50); }
.radio-card.warn:has(input:checked) { border-color: var(--red); background: var(--red-bg); }
.radio-card input { margin-top: 4px; }
.radio-card small { display: block; color: var(--muted); }

/* ---------- Bảng tin (feed) ---------- */
.feed { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.feed-card { padding: 0; }
.feed-head { display: flex; gap: 10px; align-items: center; padding: 14px 16px 6px; }
.feed-type { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.feed-type svg { width: 13px; height: 13px; }
.ft-issue { color: var(--blue); } .ft-knowledge { color: var(--green); } .ft-sop { color: var(--violet); } .ft-feedback { color: var(--gold-600); }
.feed-body { padding: 4px 16px 10px; }
.feed-title { display: block; font-weight: 650; font-size: 15.5px; color: var(--text); margin-bottom: 4px; }
.feed-title:hover { color: var(--navy-700); }
.feed-excerpt { margin: 8px 0 0; color: var(--text); }
.feed-foot { border-top: 1px solid var(--border); padding: 10px 16px 12px; background: var(--navy-50); border-radius: 0 0 var(--radius) var(--radius); }
.feed-comments { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.feed-comments li { display: flex; gap: 8px; align-items: flex-start; }
.feed-comments .bubble { background: #fff; }
.feed-comments .prose { max-height: 9.5em; overflow: hidden; }
.feed-reply { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
.feed-reply textarea { flex: 1; min-height: 36px; resize: none; }
.chip-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 4px; }
.center { text-align: center; }

/* ---------- Home: Bảng tin + right column (my work, pinned Knowledge / SOP, feedback) ---------- */
.home { display: grid; grid-template-columns: minmax(0, 760px) minmax(280px, 340px); gap: 18px; align-items: start; }
.home .feed { max-width: none; }
.home-side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.home-side .card-head h2 { display: flex; align-items: center; gap: 6px; }
@media (max-width: 1100px) { .home { grid-template-columns: 1fr; } .home-side { position: static; order: -1; } }
.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mini-stat { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; background: var(--navy-50); border: 1px solid transparent; color: var(--text); }
.mini-stat:hover { text-decoration: none; border-color: var(--gold); color: var(--text); }
.mini-stat .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.mini-stat .l { font-size: 12px; color: var(--muted); }
.mini-stat.warn .v { color: var(--gold-600); }
.mini-stat.danger .v { color: var(--red); }
.mini-stat.info .v { color: var(--blue); }
.list.compact li { padding: 8px 14px; }
.pin-group + .pin-group { margin-top: 12px; }
.pin-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }
.pin-list { list-style: none; margin: 0; padding: 0; }
.pin-list li { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.pin-list li:last-child { border-bottom: 0; }
.pin-list a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pin-list .unpin { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.pin-list .unpin:hover { color: var(--red); background: var(--navy-50); }
.btn.pinned { border-color: var(--gold); background: var(--gold-50); color: var(--navy); }

/* ---------- Responsive layout (phone 360–430 · tablet 768–1024 · laptop 1280–1440 · desktop 1920+) ---------- */
/* content fills the screen up to a comfortable reading width and is centred on very wide screens */
.content { max-width: 1600px; margin-inline: auto; }
@media (min-width: 1800px) { .content { padding-left: 32px; padding-right: 32px; } }

/* stat tiles: rows always full — the last tiles of a row stretch instead of leaving holes */
.stats { display: flex; flex-wrap: wrap; }
.stats > .stat { flex: 1 1 150px; min-width: 0; }
@media (max-width: 520px) { .stats > .stat { flex-basis: 40%; } .stat .value { font-size: 24px; } }

/* dashboard lists: two columns from laptop, three on large desktops */
@media (min-width: 1680px) { .grid.cols-2.dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* home (Bảng tin): feed + right column, centred block so wide screens do not leave an empty right side */
.home-page { max-width: 1280px; margin-inline: auto; }
.home { grid-template-columns: minmax(0, 1fr) 340px; }
@media (min-width: 1700px) { .home-page { max-width: 1400px; } .home { grid-template-columns: minmax(0, 1fr) 380px; } }
@media (max-width: 1100px) { .home { grid-template-columns: 1fr; } .home-side { position: static; order: -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; align-items: start; } }
@media (max-width: 640px) { .home-side { grid-template-columns: 1fr; } }

/* feed card meta (status, category, version, owner) — spaced, not run together */
.feed-body .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 12.5px; margin: 4px 0 6px; }
.feed-body .meta > span:not(.badge) + span:not(.badge)::before { content: "·"; margin-right: 10px; color: var(--faint); }

/* tablet: narrower sidebar, topbar search shrinks */
@media (max-width: 1100px) and (min-width: 761px) {
  .topbar { padding-left: 16px; padding-right: 16px; }
  .content { padding-left: 18px; padding-right: 18px; }
}

/* phone: compact top bar, scrollable menu row, full-width actions */
@media (max-width: 760px) {
  .sidebar { z-index: 25; }
  .nav { padding: 6px 8px; gap: 4px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 7px 10px; white-space: nowrap; }
  .nav a.active { box-shadow: inset 0 -3px 0 var(--gold); }
  .nav .group { display: none; }
  .topbar { gap: 8px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
  .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
  .usermenu > button span:not(.avatar) { display: none; }
  .page-head h1 { font-size: 21px; }
  .page-head .actions { width: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips > * { flex: none; }
}

/* login: the faded flower mark sits with its centre on the panel corner (a quarter shows) */
.login-art::after { content: ""; position: absolute; right: 0; bottom: 0; width: clamp(360px, 42vw, 720px); height: clamp(360px, 42vw, 720px);
  border: 0; border-radius: 0; background: url("../img/icon-512.png") center / contain no-repeat; opacity: .09;
  transform: translate(50%, 50%); pointer-events: none; }
.login-art > * { position: relative; z-index: 1; }
@media (min-width: 1600px) { .login-art { padding-left: 8vw; } .login-art img { width: 240px; } .login-art h1 { font-size: 34px; } .login-art p { font-size: 17px; max-width: 520px; } }
@media (max-width: 760px) {
  .login-wrap { min-height: 100svh; grid-template-rows: auto 1fr; }
  .login-art { padding: 28px 20px 32px; }
  .login-art::after { width: 260px; height: 260px; }
  .login-form { align-items: flex-start; padding: 28px 20px; }
}
/* "@" quick search popup + code links */
.mention-pop { position: fixed; z-index: 60; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 4px; }
.mention-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: center; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.mention-item.active, .mention-item:hover { background: var(--navy-50); }
.mention-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 1px 6px; border-radius: 4px; background: var(--navy-100); color: var(--navy-700); }
.mention-type.mt-sop { background: var(--gold-100); color: #8a5300; }
.mention-type.mt-kb { background: #e6f4ea; color: #1e6b45; }
.mention-code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); white-space: nowrap; }
.mention-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-empty { padding: 8px; color: var(--muted); font-size: 13px; }
a.code-link { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: var(--navy-50); padding: 0 4px; border-radius: 4px; }
.code-check { display: block; margin-top: 4px; font-size: 12.5px; min-height: 1em; }
.code-check.ok { color: var(--green, #1e7d4f); }
.code-check.bad { color: var(--red); }

/* an odd last tile spans the row instead of leaving a hole */
.mini-stats > :last-child:nth-child(odd) { grid-column: 1 / -1; }

/* collapsible left menu: .rail = icon rail (labels as tooltips); default on tablets, user can toggle anywhere */
.shell { transition: grid-template-columns .18s ease; }
.nav-toggle { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--muted); cursor: pointer; padding: 0; }
.nav-toggle:hover { color: var(--navy); border-color: var(--border-strong); background: var(--navy-50); }
.nav-toggle svg { width: 18px; height: 18px; }
@media (min-width: 761px) {
  .shell.rail { --sidebar: 68px; }
  .shell.rail .sidebar .brand { display: flex; justify-content: center; padding: 12px 8px; }
  .shell.rail .sidebar .brand img.brand-logo { display: none; }
  .shell.rail .sidebar .brand .brand-mark { display: block; width: 34px; height: 34px; max-width: none; }
  .shell.rail .nav { padding: 10px 8px; align-items: stretch; }
  .shell.rail .nav a { font-size: 0; justify-content: center; padding: 11px 0; position: relative; }
  .shell.rail .nav a svg { width: 21px; height: 21px; }
  .shell.rail .nav a .count { position: absolute; top: 3px; right: 6px; font-size: 10px; padding: 0 5px; }
  .shell.rail .nav .group, .shell.rail .sidebar .foot, .shell.rail .nav a:not(:has(svg)) { display: none; }
}
@media (max-width: 760px) { .shell.nav-hidden .nav { display: none; } }
/* below the two-column home: summary blocks stay compact so the feed starts high on the screen */
@media (max-width: 1100px) {
  .home-side .mini-stats { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
  .home-side .mini-stats > :last-child:nth-child(odd) { grid-column: auto; }
  .home-side .list.compact { display: none; }
}
.login-eyebrow { color: var(--gold); font-weight: 700; letter-spacing: .14em; font-size: 13px; margin-top: 32px; }
.login-eyebrow + h1 { margin-top: 6px; }
.mention-type.mt-user { background: #e8f0fc; color: #1f5fbf; }
.mention { color: var(--blue, #1f5fbf); font-weight: 600; background: #e8f0fc; padding: 0 4px; border-radius: 4px; }
.notif-types { margin: 4px 0 6px 26px; }
.notif-types summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
.notif-opt.sub { font-size: 12.5px; padding: 2px 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px; }
/* Issues → Lịch (by due date) */
.cal { overflow: hidden; }
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; }
.cal-nav strong { font-size: 16px; min-width: 120px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.cal-wd { padding: 6px 8px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--navy-50); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 112px; min-width: 0; padding: 4px 5px 6px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-grid > :nth-child(7n) { border-right: 0; }
.cal-day.other { background: #fafbfc; }
.cal-day.other .cal-num { color: var(--faint); }
.cal-num { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.cal-day.today { background: var(--gold-50); }
.cal-day.today .cal-num { background: var(--gold); color: var(--navy); }
.cal-day.drop-target { background: var(--gold-50); outline: 2px dashed var(--gold); outline-offset: -2px; }
.cal-item { display: block; font-size: 12px; line-height: 1.35; padding: 2px 6px; border-radius: 4px; border-left: 3px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; }
.cal-item:hover { text-decoration: none; filter: brightness(.96); }
.cal-item .key { font-weight: 700; margin-right: 4px; opacity: .8; }
.cal-item.st-resolved { opacity: .65; }
.cal-item.prio-high { border-left-color: var(--red); }
.cal-item.overdue { background: var(--red-bg); color: var(--red); }
.cal-item[hidden] { display: none; }
.cal-day.expanded .cal-item[hidden] { display: block; }
.cal-more { align-self: flex-start; border: 0; background: none; padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--gold-600); cursor: pointer; }
.cal-agenda { display: none; border-top: 1px solid var(--border); }
.cal-agenda-day { padding: 8px 14px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.cal-agenda-day h3 { font-size: 13px; margin: 0 0 2px; color: var(--muted); }
.cal-agenda-day.today h3 { color: var(--gold-600); }
.cal-agenda .cal-item { font-size: 13.5px; padding: 6px 8px; white-space: normal; }
@media (max-width: 760px) { .cal-grid { display: none; } .cal-agenda { display: block; } }
/* language switch (login page, user menu) */
.lang-switch { display: inline-flex; gap: 2px; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface); }
.lang-switch button { border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); padding: 4px 10px; border-radius: 999px; cursor: pointer; width: auto; }
.lang-switch button:hover { color: var(--text); background: var(--navy-50); }
.lang-switch button.active { background: var(--navy); color: #fff; }
.login-form { position: relative; }
.login-form > .lang-switch { position: absolute; top: 16px; right: 16px; }
.menu-langs { padding: 6px 10px 4px; border-top: 1px solid var(--border); margin-top: 4px; }
.menu .lang-switch button { display: inline-block; width: auto; text-align: center; padding: 4px 10px; }
.cal-day-head { display: flex; align-items: center; justify-content: space-between; }
.cal-add { border: 0; background: none; color: var(--gold-600); font-size: 16px; font-weight: 700; line-height: 1; width: 22px; height: 22px; border-radius: 6px; cursor: pointer; opacity: 0; transition: opacity .12s; }
.cal-day.can-add { cursor: pointer; }
.cal-day.can-add:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--gold-100); }
.cal-day.can-add:hover { background: var(--navy-50); }
.cal-day.today.can-add:hover { background: var(--gold-50); }
@media (hover: none) { .cal-add { opacity: 1; } }
