/* Layout: thanh điều hướng trái (藍), vùng làm việc sáng. AI = xanh 若竹, người duyệt = dấu 印鑑 đỏ 朱. */
:root {
  --ink: #1b2430;
  --ink-2: #4a5566;
  --ink-3: #7b8597;
  --paper: #f4f6f8;
  --surface: #ffffff;
  --line: #dde2e9;
  --ai-iro: #1f4a80;      /* 藍: điều hướng, nút chính */
  --ai-iro-soft: #e7eef8;
  --wakatake: #17756a;    /* 若竹: nội dung do AI tạo */
  --wakatake-soft: #e3f2ef;
  --shu: #c23b22;         /* 朱: dấu duyệt */
  --ok: #2f7d4a;  --ok-soft: #e5f3ea;
  --warn: #a8670b; --warn-soft: #fbf0dc;
  --bad: #b42318; --bad-soft: #fde8e6;
  --font-body-ja: "Zen Kaku Gothic New", "Be Vietnam Pro", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-body-vi: "Be Vietnam Pro", "Zen Kaku Gothic New", "Segoe UI", sans-serif;
  --font-display-ja: "Shippori Mincho B1", "Yu Mincho", serif;
  --font-display-vi: "Be Vietnam Pro", "Segoe UI", sans-serif;
  color-scheme: light;
}

html[lang="ja"] [data-l="vi"],
html[lang="vi"] [data-l="ja"] { display: none !important; }

html, body { background: var(--paper); color: var(--ink); }
html[lang="ja"] body { font-family: var(--font-body-ja); }
html[lang="vi"] body { font-family: var(--font-body-vi); }
body { font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }

.font-display { text-wrap: balance; }
html[lang="ja"] .font-display { font-family: var(--font-display-ja); font-weight: 700; letter-spacing: .02em; }
html[lang="vi"] .font-display { font-family: var(--font-display-vi); font-weight: 700; letter-spacing: -.01em; }

.num { font-variant-numeric: tabular-nums; }

/* ----- Shell ----- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--ai-iro); color: #dfe8f5; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar a.nav { display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin: 1px 10px; border-radius: 6px; color: #d5e0f0; text-decoration: none; }
.sidebar a.nav:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar a.nav[aria-current="page"] { background: #fff; color: var(--ai-iro); font-weight: 600; }
.sidebar a.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar .group { font-size: 11.5px; color: #9fb3d1; padding: 16px 24px 4px; letter-spacing: .04em; }
.nav-badge { margin-left: auto; background: var(--shu); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; font-weight: 600; }
.sidebar a.nav[aria-current="page"] .nav-badge { background: var(--shu); color: #fff; }

.topbar { position: sticky; top: 0; z-index: 30; background: rgba(244,246,248,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.main-pad { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(15,25,40,.35); }
}

/* ----- Components ----- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 7px; font-weight: 600; font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #b9c2cf; }
.btn-primary { background: var(--ai-iro); border-color: var(--ai-iro); color: #fff; }
.btn-primary:hover { background: #193e6c; }
.btn-shu { background: var(--shu); border-color: var(--shu); color: #fff; }
.btn-shu:hover { background: #a63220; }
.btn svg { width: 16px; height: 16px; }
:focus-visible { outline: 2px solid var(--ai-iro); outline-offset: 2px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip svg { width: 13px; height: 13px; }
.chip-ai { background: var(--wakatake-soft); color: var(--wakatake); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-mute { background: #eef1f5; color: var(--ink-2); }
.chip-blue { background: var(--ai-iro-soft); color: var(--ai-iro); }

/* nội dung AI soạn: viền trái nét đứt màu 若竹 */
.ai-block { border-left: 3px dashed var(--wakatake); background: linear-gradient(90deg, var(--wakatake-soft), transparent 70%); padding: 10px 14px; border-radius: 0 8px 8px 0; }

.health { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.health.g { background: var(--ok); } .health.y { background: #d69e2e; } .health.r { background: var(--bad); }

table.grid-t { width: 100%; border-collapse: collapse; }
table.grid-t th { text-align: left; font-weight: 600; font-size: 12px; color: var(--ink-3); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid-t td { padding: 10px 12px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
table.grid-t tr:last-child td { border-bottom: 0; }
table.grid-t td.r, table.grid-t th.r { text-align: right; }
.scroll-x { overflow-x: auto; }

.tool-call { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--wakatake); background: var(--wakatake-soft); border-radius: 6px; padding: 2px 8px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* ----- 印鑑 (dấu duyệt) ----- */
.hanko { width: 64px; height: 64px; border: 3px solid var(--shu); border-radius: 50%; color: var(--shu); display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; font-family: var(--font-display-ja); font-weight: 700; transform: rotate(-12deg); background: rgba(255,255,255,.6); flex: none; }
.hanko .h1 { font-size: 15px; border-bottom: 1.5px solid var(--shu); padding-bottom: 1px; }
.hanko .h2 { font-size: 9px; padding-top: 2px; font-family: var(--font-body-ja); }
.hanko .h3 { font-size: 11px; }
.hanko.press { animation: press .42s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes press { 0% { transform: scale(1.8) rotate(-4deg); opacity: 0; } 60% { transform: scale(.92) rotate(-13deg); opacity: 1; } 100% { transform: scale(1) rotate(-12deg); } }

/* ----- Flow guide ----- */
.flow-bar { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(720px, calc(100% - 32px)); background: var(--ink); color: #eef2f7; border-radius: 12px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; box-shadow: 0 10px 30px rgba(20,30,45,.3); }
.flow-bar .btn { background: transparent; color: #eef2f7; border-color: #44516a; }
.flow-bar .btn-primary { background: #fff; color: var(--ink); border-color: #fff; }
.flow-focus { outline: 3px solid #e0a43a !important; outline-offset: 3px; border-radius: 10px; }
body.has-flow { padding-bottom: 110px; }

.toast { position: fixed; z-index: 70; right: max(16px, env(safe-area-inset-right, 0px)); top: calc(70px + env(safe-area-inset-top, 0px)); background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; display: flex; gap: 8px; align-items: center; box-shadow: 0 8px 24px rgba(20,30,45,.25); }
.toast svg { width: 16px; height: 16px; color: #8fd3c6; }

/* Email preview (giống Outlook) */
.mail-frame { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.mail-frame .mf-head { background: #f0f3f7; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }

.list-item { display: block; width: 100%; text-align: left; padding: 12px 14px; border-bottom: 1px solid #edf0f4; background: transparent; cursor: pointer; }
.list-item:hover { background: #f7f9fb; }
.list-item[aria-selected="true"] { background: var(--ai-iro-soft); box-shadow: inset 3px 0 0 var(--ai-iro); }

.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--wakatake); margin-right: 3px; animation: blink 1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Grid/flex con không được đẩy trang rộng ra trên điện thoại */
.grid > *, #main > * { min-width: 0; }
.panel-head { flex-wrap: wrap; row-gap: 4px; }
.mail-frame, .ai-block { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .flow-bar { flex-wrap: wrap; }
  .flow-bar > div:last-child { width: 100%; justify-content: flex-end; }
  body.has-flow { padding-bottom: 170px; }
}

/* ----- Trợ lý AI nổi ----- */
.ai-fab { position: fixed; z-index: 62; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 18px 0 15px; border-radius: 26px;
  background: var(--wakatake); color: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 8px 24px rgba(23,117,106,.35);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.ai-fab svg { width: 20px; height: 20px; }
.ai-fab.dragging { cursor: grabbing; box-shadow: 0 14px 34px rgba(23,117,106,.45); transform: scale(1.04); }
body.has-flow .ai-fab:not([style]) { bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }

.ai-win { position: fixed; z-index: 65; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 18px 50px rgba(20,30,45,.28); overflow: hidden; }
.ai-win.dragging { user-select: none; -webkit-user-select: none; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 14px; background: var(--wakatake); color: #fff;
  cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; position: relative; flex: none; }
.ai-head > button, .ai-head > a { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.ai-head > button:hover, .ai-head > a:hover { background: rgba(255,255,255,.16); }
.ai-head > button svg, .ai-head > a svg { width: 18px; height: 18px; }
.ai-ctx { display: flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 12px; background: var(--wakatake-soft); color: var(--wakatake); border-bottom: 1px solid var(--line); flex: none; }
.ai-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: grid; gap: 10px; align-content: start; overscroll-behavior: contain; background: var(--paper); }
.ai-u { justify-self: end; max-width: 88%; background: var(--ai-iro); color: #fff; padding: 8px 12px; border-radius: 14px 14px 4px 14px; font-size: 13.5px; }
.ai-b { display: grid; gap: 6px; max-width: 100%; min-width: 0; }
.ai-b .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 10px 12px; font-size: 13.5px; min-width: 0; }
.ai-sugg { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px; border-top: 1px solid var(--line); scrollbar-width: none; flex: none; background: var(--surface); }
.ai-sugg::-webkit-scrollbar { display: none; }
.ai-sugg button { flex: none; border: 1px solid #b9dcd6; color: var(--wakatake); border-radius: 999px; padding: 6px 12px; font-size: 13px; background: var(--surface); white-space: nowrap; }
.ai-sugg button:hover { background: var(--wakatake-soft); }
.ai-form { display: flex; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line); flex: none; background: var(--surface); }
.ai-form input { flex: 1; min-width: 0; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface); }
.ai-send { width: 42px; border-radius: 10px; background: var(--wakatake); color: #fff; display: grid; place-items: center; flex: none; }
.ai-send svg { width: 18px; height: 18px; }
.ai-rz { position: absolute; z-index: 3; touch-action: none; }
.ai-rz[data-d="n"] { top: -3px; left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.ai-rz[data-d="s"] { bottom: -3px; left: 14px; right: 14px; height: 8px; cursor: ns-resize; }
.ai-rz[data-d="e"] { right: -3px; top: 14px; bottom: 14px; width: 8px; cursor: ew-resize; }
.ai-rz[data-d="w"] { left: -3px; top: 14px; bottom: 14px; width: 8px; cursor: ew-resize; }
.ai-rz[data-d="ne"] { right: -3px; top: -3px; width: 16px; height: 16px; cursor: nesw-resize; }
.ai-rz[data-d="nw"] { left: -3px; top: -3px; width: 16px; height: 16px; cursor: nwse-resize; }
.ai-rz[data-d="sw"] { left: -3px; bottom: -3px; width: 16px; height: 16px; cursor: nesw-resize; }
.ai-rz[data-d="se"] { right: -1px; bottom: -1px; width: 18px; height: 18px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 0 55%, #9aa6b6 55% 60%, transparent 60% 70%, #9aa6b6 70% 75%, transparent 75%); }

/* Điện thoại: bottom sheet */
.ai-win.sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 96dvh; border-radius: 18px 18px 0 0; border-bottom: 0;
  transition: height .22s ease; box-shadow: 0 -10px 40px rgba(20,30,45,.25); }
.ai-win.sheet.dragging { transition: none; }
.ai-win.sheet .ai-head { padding-top: 20px; cursor: ns-resize; }
.ai-win.sheet .ai-head::before { content: ""; position: absolute; top: 7px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: rgba(255,255,255,.55); }
.ai-win.sheet .ai-rz, .ai-win.sheet .ai-desk { display: none; }
.ai-win.sheet .ai-form { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
.ai-win.sheet .ai-sugg button { padding: 9px 14px; }
@media (max-width: 767px) {
  .ai-fab { height: 56px; width: 56px; padding: 0; justify-content: center; border-radius: 50%; }
  .ai-fab span { display: none; }
  body.has-flow .ai-fab:not([style]) { bottom: calc(180px + env(safe-area-inset-bottom, 0px)); }
}
.ai-win[hidden], .ai-fab[hidden] { display: none !important; }

/* ----- Khung tạo bằng AI (Quy tắc, Scheduler) ----- */
.builder { display: flex; flex-direction: column; height: 560px; max-height: calc(100dvh - 120px); overflow: hidden; }
.builder .ai-log { border-radius: 0; }
.builder .ai-sugg { flex-wrap: wrap; overflow: visible; }
.builder .ai-sugg button { white-space: normal; text-align: left; }
@media (max-width: 767px) { .builder { height: 480px; } }

/* Công tắc bật/tắt */
.switch { position: relative; width: 40px; height: 22px; border-radius: 11px; background: #c9d0da; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }

/* Sơ đồ bước của quy tắc / việc định kỳ */
.steps { display: grid; gap: 0; }
.step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; position: relative; padding-bottom: 12px; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.step .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.step .ic svg { width: 16px; height: 16px; }
.step.when .ic { background: var(--ai-iro-soft); color: var(--ai-iro); }
.step.if .ic { background: #fdf0e6; color: #9a4a12; }
.step.do .ic { background: var(--wakatake-soft); color: var(--wakatake); }
.step.human .ic { background: #fde8e6; color: var(--shu); }
.step .t { font-size: 12px; color: var(--ink-3); }
.step .d { font-size: 13.5px; }
.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 30% { background: var(--wakatake-soft); } 100% { background: transparent; } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); }
.seg button { padding: 5px 12px; border-radius: 6px; font-size: 13px; }
.seg button[aria-selected="true"] { background: var(--ai-iro); color: #fff; }
.field { display: grid; gap: 4px; font-size: 13px; }
.field > span { color: var(--ink-2); font-weight: 600; }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 14px; background: var(--surface); width: 100%; }

[hidden] { display: none !important; }

/* Nút mở trợ lý trên thanh trên cùng */
.ai-launch { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 9px; background: var(--wakatake); color: #fff; font-weight: 700; font-size: 13px; }
.ai-launch:hover { background: #12645a; }
.ai-launch svg { width: 17px; height: 17px; }
.ai-launch kbd { font-family: inherit; font-size: 11px; border: 1px solid rgba(255,255,255,.5); border-radius: 4px; padding: 0 5px; line-height: 16px; opacity: .85; }
@media (min-width: 768px) { .ai-fab { display: none !important; } }
.ai-mic { width: 42px; border-radius: 10px; border: 1px solid var(--line); color: var(--wakatake); display: grid; place-items: center; flex: none; background: var(--surface); }
.ai-mic svg { width: 18px; height: 18px; }
.ai-mic.on { background: var(--shu); border-color: var(--shu); color: #fff; animation: micpulse 1.2s infinite; }
@keyframes micpulse { 0% { box-shadow: 0 0 0 0 rgba(194,59,34,.45); } 100% { box-shadow: 0 0 0 12px rgba(194,59,34,0); } }

/* ----- Quick Report (báo cáo kiểu thư ký) ----- */
.qr { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
@media (max-width: 1023px) { .qr { grid-template-columns: minmax(0, 1fr); } }
.qr-brief { padding: 20px 22px; display: grid; gap: 14px; align-content: start; background: linear-gradient(180deg, #f3f8f7, var(--surface) 60%); }
.qr-ask { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 360px; }
@media (max-width: 1023px) { .qr-ask { border-left: 0; border-top: 1px solid var(--line); min-height: 320px; } }
.qr-ask .ai-log { max-height: 340px; }
.qr-player { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.qr-play { width: 56px; height: 56px; border-radius: 50%; background: var(--wakatake); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 6px 18px rgba(23,117,106,.35); }
.qr-play svg { width: 24px; height: 24px; }
.qr-play.idle { animation: micpulse 2s infinite; animation-name: qrpulse; }
@keyframes qrpulse { 0% { box-shadow: 0 0 0 0 rgba(23,117,106,.45); } 100% { box-shadow: 0 0 0 14px rgba(23,117,106,0); } }
.qr-bars { display: flex; align-items: center; gap: 3px; height: 28px; }
.qr-bars span { width: 4px; height: 6px; border-radius: 2px; background: var(--wakatake); opacity: .35; }
.qr.playing .qr-bars span { opacity: 1; animation: bar .9s ease-in-out infinite; }
.qr-bars span:nth-child(2n) { animation-delay: .15s !important; } .qr-bars span:nth-child(3n) { animation-delay: .3s !important; } .qr-bars span:nth-child(5n) { animation-delay: .45s !important; }
@keyframes bar { 0%, 100% { height: 6px; } 50% { height: 26px; } }
.qr-lines { display: grid; gap: 6px; }
.qr-line { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 14.5px; line-height: 1.65; text-align: left; }
.qr-line:hover { background: #f1f5f4; }
.qr-line .ic { color: var(--ink-3); margin-top: 3px; } .qr-line .ic svg { width: 16px; height: 16px; }
.qr-line.on { background: var(--wakatake-soft); }
.qr-line.on .ic { color: var(--wakatake); }
.qr-line a { font-size: 12px; color: var(--ai-iro); white-space: nowrap; margin-top: 4px; }
.qr-rate button { padding: 2px 8px; font-size: 12px; }
.qr-modal { position: fixed; inset: 0; z-index: 90; background: rgba(15,25,40,.45); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.qr-modal > .qr { width: min(1080px, 100%); max-height: 100%; overflow-y: auto; box-shadow: 0 30px 80px rgba(15,25,40,.35); }
@media (max-width: 767px) { .qr-modal { padding: 0; place-items: end stretch; } .qr-modal > .qr { border-radius: 18px 18px 0 0; max-height: 94dvh; } }
.qr-ask .ai-sugg { flex-wrap: wrap; overflow: visible; }
.qr-ask .ai-sugg button { white-space: normal; text-align: left; }
.week > div, .run span { min-width: 0; }
.run span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.builder .ai-sugg button, .qr-ask .ai-sugg button { flex: 0 1 auto; max-width: 100%; }
.list-item.flex { display: flex; }
.flow-bar { z-index: 95; }

/* ----- Mục chờ duyệt (hiển thị theo danh mục) ----- */
.appr-card { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 16px; padding: 16px; }
.appr-card + .appr-card { border-top: 1px solid var(--line); }
.decide { display: grid; gap: 6px; align-content: start; justify-items: stretch; }
@media (max-width: 640px) { .appr-card { grid-template-columns: minmax(0, 1fr); } .decide { grid-auto-flow: column; justify-content: start; } }
.diff-old { text-decoration: line-through; color: var(--ink-3); }
.diff-new { background: var(--wakatake-soft); color: var(--wakatake); font-weight: 600; padding: 0 4px; border-radius: 4px; }
blockquote.ev { border-left: 3px solid var(--line); padding: 2px 10px; color: var(--ink-2); font-size: 13px; }
.appr-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid #efc2b9; background: #fff5f3; color: var(--shu); font-weight: 700; font-size: 13px; }
.appr-btn svg { width: 17px; height: 17px; }
.appr-btn #appr-count { background: var(--shu); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11.5px; line-height: 18px; }
.appr-pop { position: absolute; right: 0; top: calc(100% + 8px); width: min(340px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(20,30,45,.18); z-index: 70; overflow: hidden; }
@media (max-width: 640px) { .appr-pop { position: fixed; left: 16px; right: 16px; width: auto; top: calc(60px + env(safe-area-inset-top, 0px)); } }
.appr-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid #f0f2f5; }
.appr-row:hover { background: #f7f9fb; }

/* Nút chuyển chế độ v1 ↔ AI Desk */
.mode-sw { display: inline-flex; align-items: center; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: #fff; flex: none; }
.mode-sw > * { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.mode-sw > * svg { width: 15px; height: 15px; }
.mode-sw .on { background: var(--ink); color: #fff; }
.mode-sw a:hover { background: var(--wakatake-soft); color: var(--wakatake); }
