:root {
  --primary: #0b6bcb;
  --primary-d: #0858a8;
  --primary-soft: rgba(11, 107, 203, 0.1);
  --accent: #0d9488;
  --bg: #e8edf4;
  --bg-spot: #d7e4f5;
  --card: #ffffff;
  --border: #d7dee8;
  --border-strong: #c5cedc;
  --text: #0f172a;
  --muted: #5b6b81;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 4px 8px rgba(15, 23, 42, 0.06), 0 16px 32px rgba(15, 23, 42, 0.08);
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 420px at 8% -10%, var(--bg-spot), transparent 55%),
    radial-gradient(900px 360px at 100% 0%, rgba(13, 148, 136, 0.08), transparent 50%),
    linear-gradient(180deg, #f3f6fb 0%, var(--bg) 42%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1140px; margin: 0 auto; padding: 18px 16px 40px; }

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(120deg, #0b2748 0%, #0d4f8b 52%, #0b6bcb 100%);
  color: #fff; padding: 12px 16px; border-radius: calc(var(--radius) + 2px);
  margin-bottom: 16px;
  box-shadow: 0 10px 28px rgba(11, 79, 139, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.home-btn {
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff; font-weight: 700; font-size: 14px; letter-spacing: -0.02em;
  padding: 9px 14px; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.home-btn:hover { background: rgba(255, 255, 255, 0.2); transform: translateY(-1px); }
.userbar { display: flex; align-items: center; gap: 10px; }
.admin-mode-form { margin: 0; display: inline; }
.admin-mode-btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease);
}
.admin-mode-btn:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.admin-mode-btn.is-on {
  background: #f59e0b;
  border-color: #fbbf24;
  color: #1e293b;
}
.admin-mode-banner {
  margin-bottom: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #fffbeb, #fef3c7);
  border: 1px solid #f6d687;
  color: #92400e;
  font-size: 13px;
  font-weight: 600;
}
.ava {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(145deg, #fff, #dbeafe);
  color: #0b4f8b;
  font-weight: 700; display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}
.uinfo { line-height: 1.25; text-align: right; }
.uname { font-weight: 650; font-size: 13px; }
.upos { font-size: 12px; opacity: 0.82; }

/* Breadcrumb */
.crumb {
  font-size: 13px; margin: 0 2px 14px; color: var(--muted);
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
}
.cr-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.cr-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.cr-sep { margin: 0 6px; color: #b0bbc9; }
.cr-cur { font-weight: 650; color: var(--text); }

/* Page intro */
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.page-head h1, .page-title {
  margin: 0 0 4px; font-size: 1.35rem; font-weight: 750; letter-spacing: -0.03em;
  line-height: 1.25;
}
.page-sub { margin: 0; color: var(--muted); font-size: 13px; max-width: 62ch; }

/* Card */
.card {
  background: var(--card);
  border: 1px solid rgba(215, 222, 232, 0.95);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  backdrop-filter: blur(6px);
}
.card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.center { text-align: center; }
.muted { color: var(--muted); }
.hint { font-size: 12px; }
.ma-cell { min-width: 140px; white-space: normal; }
.ma-warn {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: #b45309;
}
.ma-warn.ma-ok {
  color: #15803d;
}
.strong { font-weight: 650; }
code {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 1px 6px;
}

/* Sections + process cards */
.section { margin-bottom: 22px; }
.section-h {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 0 4px 10px;
}
.proc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.proc {
  display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.proc:hover {
  border-color: #9ec2ea;
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.proc-ic {
  flex: 0 0 auto; width: 50px; height: 50px; border-radius: 13px;
  background: linear-gradient(160deg, #e8f2fc, #dceaf8);
  color: var(--primary); font-weight: 700; font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(11, 107, 203, 0.08);
}
.proc-badge {
  position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1; border: 2px solid #fff;
}
.proc-alert { border-color: #fecaca; background: linear-gradient(180deg, #fff, #fff7f7); }
.proc-alert:hover { border-color: #f87171; box-shadow: 0 8px 22px rgba(220, 38, 38, 0.12); }
.proc-count-label { color: #dc2626; font-weight: 700; font-size: 13px; }
.proc-loading { opacity: 0.92; pointer-events: auto; }
.proc-badge-loading {
  background: #f1f5f9; border-color: #e2e8f0; min-width: 20px; padding: 0;
}
.proc-count-loading {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.spinner-sm {
  width: 12px; height: 12px; border: 2px solid #e2e8f0;
  border-top-color: var(--primary); border-radius: 50%;
  animation: app-spin .7s linear infinite; display: block;
}
.spinner-inline {
  width: 12px; height: 12px; border: 2px solid #e2e8f0;
  border-top-color: var(--primary); border-radius: 50%;
  animation: app-spin .7s linear infinite; display: inline-block; flex-shrink: 0;
}
.proc-tx { display: flex; flex-direction: column; min-width: 0; }
.proc-ti { font-weight: 650; letter-spacing: -0.02em; }
.proc-de { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.home-search-bar {
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(215, 222, 232, 0.9); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.home-search-bar .search { flex: 1 1 auto; width: auto; max-width: 440px; }
.home-refresh-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.home-refresh-btn .home-refresh-ic { display: inline-block; font-size: 15px; line-height: 1; }
.home-refresh-btn.is-loading { opacity: 0.7; pointer-events: none; }
.home-refresh-btn.is-loading .home-refresh-ic { animation: home-refresh-spin 0.7s linear infinite; }
@keyframes home-refresh-spin { to { transform: rotate(360deg); } }
.home-search-hidden { display: none !important; }
.home-search-section-hidden { display: none !important; }
.search-hl { background: #fef08a; color: inherit; padding: 0 1px; border-radius: 2px; }
.admin-bar {
  margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  padding-top: 14px; border-top: 1px dashed var(--border);
}

/* Toolbar */
.toolbar {
  display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center;
}
.search {
  flex: 1 1 220px; min-width: 180px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px;
  background: #fff; font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.select {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; background: #fff; font-family: inherit;
}

/* Buttons */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 9px 14px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; line-height: 1.2;
}
.btn:hover { background: #f5f7fb; border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.sm, .btn.ghost.sm { padding: 6px 10px; font-size: 12.5px; }
.primary, .btn.primary {
  background: linear-gradient(180deg, #1277d8, var(--primary));
  border-color: var(--primary-d); color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 6px 14px rgba(11, 107, 203, 0.22);
}
.primary:hover, .btn.primary:hover {
  background: linear-gradient(180deg, var(--primary), var(--primary-d));
  color: #fff;
}
.btn:disabled,
.btn.primary:disabled,
.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn.primary:disabled:hover,
.primary:disabled:hover {
  background: linear-gradient(180deg, #1277d8, var(--primary));
  color: #fff;
}
.ghost, .btn.ghost { background: transparent; }
.danger { color: #dc2626; border-color: #fecaca; }
.danger:hover { background: #fef2f2; }
.mini {
  font-size: 12px; padding: 5px 9px; border: 1px solid var(--border); background: #fff;
  border-radius: 8px; cursor: pointer; margin-left: 4px; text-decoration: none; color: inherit;
  display: inline-block; font-weight: 600; font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.mini:hover { background: #f1f5f9; border-color: var(--border-strong); }
.mini.danger { color: #b91c1c; border-color: #fecaca; }
.inline-form { display: inline; }

/* Tables — scroll ngang trong card, không tràn viền trang */
.tablewrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  border-radius: calc(var(--radius) - 4px);
}
.card.tablewrap,
.card > .tablewrap {
  max-width: 100%;
}
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th, .table td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid #eef2f7; white-space: nowrap;
}
.table th {
  background: #f4f7fb; font-weight: 650; color: #3b4b63;
  font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase;
}
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: #f7faff; }
.table tbody tr:last-child td { border-bottom: none; }
.row-act { white-space: nowrap; text-align: right; }
/* Cot thao tac (Xem/Sua/Xoa) ghim ben phai — khong phai keo ngang */
.table th.act-col, .table td.row-act {
  position: sticky; right: 0;
  box-shadow: -8px 0 8px -8px rgba(15, 23, 42, 0.2);
}
.table td.row-act { background: #fff; z-index: 1; }
.table th.act-col { background: #f4f7fb; z-index: 3; }
.table tbody tr:hover td.row-act { background: #f7faff; }
.grid .input { min-width: 120px; }
.grid th.col-hidden,
.grid td.col-hidden { display: none; }

/* Key-value */
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv th { text-align: left; width: 38%; vertical-align: top; padding: 8px 10px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); }
.kv td { padding: 8px 10px; border-bottom: 1px solid var(--border); }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e2e8f0; color: #334155; }
.badge.draft { background: #e2e8f0; color: #475569; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.pending-tp { background: #fef3c7; color: #92400e; }
.badge.pending-qlts { background: #ffedd5; color: #c2410c; }
.badge.pending-bpcm { background: #ede9fe; color: #6d28d9; }
.badge.pending-gd { background: #fce7f3; color: #9d174d; }
.badge.approved { background: #dbeafe; color: #1e40af; }
.badge.rejected { background: #fee2e2; color: #991b1b; }
.badge.done { background: #dcfce7; color: #166534; }

.approval-flow { margin-bottom: 12px; }
.approval-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.approval-step {
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}
.approval-step.is-current { background: #dbeafe; color: #1e40af; font-weight: 600; }
.approval-arrow { color: #94a3b8; font-size: 12px; }

.appr-tabs {
  display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap;
  padding: 4px; border-radius: 12px; background: #f3f6fb; border: 1px solid var(--border);
}
.appr-tab {
  border: none; background: transparent; color: var(--muted);
  padding: 9px 14px; border-radius: 9px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: background 0.15s, color 0.15s;
}
.appr-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.7); }
.appr-tab.is-active {
  background: #fff; color: var(--primary-d);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.appr-pending-table .appr-main-cell { min-width: 160px; max-width: 280px; }
.appr-clamp {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-top: 2px; line-height: 1.35;
}
.badge.sm { font-size: 11px; padding: 2px 7px; vertical-align: middle; }
.appr-overdue { color: #b91c1c; font-weight: 600; font-size: 12px; }

/* Bitrix24-style workflow board */
.appr-wf-board {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; margin-bottom: 0;
}
.appr-wf-table { margin: 0; }
.appr-wf-table th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.appr-wf-table td { vertical-align: middle; padding: 12px 10px; border-top: 1px solid #eef2f7; }
.appr-wf-row:hover { background: #f8fafc; }
.col-check { width: 36px; text-align: center; }
.appr-name-cell { min-width: 180px; max-width: 260px; }
.appr-doc-link { font-weight: 700; color: #2563eb; text-decoration: none; }
.appr-doc-link:hover { text-decoration: underline; }
.appr-sub-type { font-size: 11px; color: #94a3b8; letter-spacing: 0.03em; margin-top: 2px; }
.appr-updated { font-size: 13px; color: #475569; white-space: nowrap; }
.appr-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; margin-left: 6px; vertical-align: middle; }
.appr-status-cell { min-width: 140px; max-width: 200px; }
.appr-status-text { font-size: 12px; color: #334155; margin-bottom: 4px; line-height: 1.35; }
.appr-act-cell { white-space: nowrap; }
.appr-row-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

.appr-bulk-dock {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 12px; padding: 12px 14px;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border: 1px solid var(--border); border-radius: 10px;
}
.appr-bulk-dock .appr-bulk-comment { flex: 1 1 180px; min-width: 140px; margin: 0; max-width: 320px; }
.appr-bulk-action { width: auto; min-width: 110px; font-weight: 700; font-size: 12px; }
.appr-selected-count { margin-left: auto; font-size: 12px; font-weight: 700; color: #475569; letter-spacing: 0.04em; }
.appr-bulk-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.btn.danger { color: #fff; background: #dc2626; border-color: #dc2626; }
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn.danger.ghost { color: #b91c1c; background: transparent; border-color: #fecaca; }
.btn.danger.ghost:hover { background: #fef2f2; }

.wf-col-labels {
  display: flex; gap: 28px; font-size: 10px; color: #94a3b8; text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 4px;
}
.wf-col-labels span { min-width: 48px; text-align: center; }

/* Bitrix24 3-column participant flow */
.wf-flow-b24 {
  display: flex; align-items: flex-start; gap: 0; min-width: 320px;
}
.wf-slot {
  flex: 1; min-width: 76px; max-width: 110px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 4px 2px; border-radius: 10px; transition: background .15s, box-shadow .15s;
}
.wf-slot-label {
  font-size: 11px; color: #64748b; margin-bottom: 6px; min-height: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px;
}
.wf-slot-who {
  font-size: 11px; color: #475569; margin-top: 4px; max-width: 100px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2;
}
.wf-slot-now {
  margin-top: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; color: #1d4ed8; background: #dbeafe;
  border-radius: 999px; padding: 2px 7px; white-space: nowrap;
}
.wf-slot-time {
  font-size: 11px; color: #94a3b8; margin-top: 2px; min-height: 14px;
}
.wf-conn {
  display: flex; align-items: center; padding-top: 28px; width: 20px; flex-shrink: 0;
}
.wf-dots { color: #cbd5e1; font-size: 14px; letter-spacing: 1px; line-height: 1; }
.wf-slot.is-done { opacity: 0.78; }
.wf-slot.is-done .wf-ava, .wf-slot.is-done .wf-ava-ph { border-color: #86efac; }
.wf-slot.is-pending { opacity: 0.55; }
.wf-slot.is-current {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 0 0 2px #3b82f6, 0 4px 14px rgba(37, 99, 235, 0.22);
  opacity: 1;
  max-width: 120px;
  min-width: 88px;
  padding: 8px 6px 10px;
  z-index: 1;
}
.wf-slot.is-current .wf-slot-label {
  color: #1e40af; font-weight: 700; font-size: 12px;
}
.wf-slot.is-current .wf-slot-who {
  color: #1d4ed8; font-weight: 700; font-size: 12px; max-width: 108px;
}
.wf-slot.is-current .wf-ava,
.wf-slot.is-current .wf-ava-ph {
  width: 44px; height: 44px; border-width: 3px; border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
  font-size: 15px;
}
.wf-slot.is-current .wf-badge {
  width: 18px; height: 18px; font-size: 10px; right: -5px; bottom: -3px;
}
.wf-slot.is-rejected {
  background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%);
  box-shadow: 0 0 0 2px #ef4444, 0 4px 14px rgba(239, 68, 68, 0.2);
  opacity: 1;
  max-width: 120px;
  min-width: 88px;
  padding: 8px 6px 10px;
  z-index: 1;
}
.wf-slot.is-rejected .wf-slot-label { color: #b91c1c; font-weight: 700; }
.wf-slot.is-rejected .wf-ava, .wf-slot.is-rejected .wf-ava-ph { border-color: #f87171; }
.wf-ava-reject {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 16px; font-weight: 800; color: #fff;
  border: 2px solid #dc2626; background: #ef4444;
}
.wf-slot.is-rejected .wf-ava-reject { width: 44px; height: 44px; font-size: 18px; }
.wf-badge-reject { background: #dc2626; color: #fff; font-weight: 700; }
.wf-slot-now-reject {
  color: #991b1b !important; background: #fecaca !important;
}
.wf-slot.is-skipped .wf-slot-label { color: #b45309; text-decoration: line-through; }
.wf-ava-skip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 16px; font-weight: 800; color: #92400e;
  border: 2px dashed #d97706; background: #fef3c7;
}
.wf-badge-skip { background: #d97706; color: #fff; font-weight: 700; }
.wf-slot-now-skip {
  color: #92400e !important; background: #fde68a !important;
}

/* Workflow track (legacy fallback) */
.wf-cell { min-width: 200px; }
.wf-track { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2px; }
.wf-track-simple { font-size: 13px; }
.wf-step {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  max-width: 72px; text-align: center; position: relative;
}
.wf-ava-wrap { position: relative; display: inline-block; }
.wf-ava {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  border: 2px solid #e2e8f0; background: #f1f5f9; display: block;
}
.wf-ava-ph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 13px; font-weight: 700; color: #475569;
  border: 2px solid #e2e8f0; background: #f1f5f9;
}
.wf-ava-ghost {
  display: inline-block; width: 36px; height: 36px; border-radius: 50%;
  border: 2px dashed #cbd5e1; background: #f8fafc;
  background-image: radial-gradient(circle, #cbd5e1 2px, transparent 2px);
  background-size: 8px 8px;
}
.wf-step.is-done .wf-ava, .wf-step.is-done .wf-ava-ph { border-color: #86efac; opacity: 0.9; }
.wf-step.is-current .wf-ava, .wf-step.is-current .wf-ava-ph {
  border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.2);
}
.wf-step.is-pending .wf-ava-ghost { opacity: 0.75; }
.wf-badge {
  position: absolute; right: -4px; bottom: -2px;
  width: 16px; height: 16px; border-radius: 50%;
  font-size: 9px; line-height: 16px; text-align: center;
  border: 2px solid #fff;
}
.wf-badge-clock { background: #3b82f6; color: #fff; }
.wf-badge-done { background: #22c55e; color: #fff; font-weight: 700; }
.wf-step-name {
  font-size: 10px; color: var(--muted); line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 72px;
}
.wf-arrow { color: #94a3b8; font-size: 14px; margin: 10px 2px 0; align-self: flex-start; }

/* Form */
.form .field { margin-bottom: 16px; }
.field > label {
  display: block; font-weight: 650; font-size: 13px; margin-bottom: 6px; color: #2f3f55;
  letter-spacing: -0.01em;
}
.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  background: #fff; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover { border-color: var(--border-strong); }
.input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input.sm { padding: 7px 10px; font-size: 13px; }
textarea.input { min-height: 84px; resize: vertical; }
/* User picker combobox (Bitrix24-style) */
.user-picker { position: relative; max-width: 100%; }
.user-picker-bulk { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.user-picker-combo {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 42px; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: text;
}
.user-picker-combo.is-open,
.user-picker-combo:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.user-picker-chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.user-picker-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #e8f4fc; border-radius: 18px;
  padding: 2px 8px 2px 2px; font-size: 13px; color: #0f172a; max-width: 100%;
}
.user-picker-chip-tx {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px;
}
.user-picker-chip-x {
  border: none; background: transparent; color: #94a3b8; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 2px; flex-shrink: 0;
}
.user-picker-chip-x:hover { color: #dc2626; }
.user-picker-ava {
  width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.user-picker-ava-init {
  display: inline-flex; align-items: center; justify-content: center;
  background: #94a3b8; color: #fff; font-size: 11px; font-weight: 600;
}
.user-picker-input {
  flex: 1; min-width: 120px; border: none !important; box-shadow: none !important;
  padding: 4px 6px !important; background: transparent !important; outline: none; font-size: 14px;
}
.user-picker-dropdown {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15,23,42,.12); overflow: hidden;
}
.user-picker-dropdown-portal {
  position: fixed !important;
  right: auto !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}
.user-picker-tabs {
  display: flex; gap: 4px; padding: 8px 10px;
  border-bottom: 1px solid var(--border); overflow-x: auto; background: #fafbfc;
}
.user-picker-tab {
  border: 1px solid var(--border); background: #f1f5f9; color: #475569;
  border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer;
  white-space: nowrap; font-family: inherit;
}
.user-picker-tab:hover { background: #e2e8f0; }
.user-picker-tab.is-active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.user-picker-list { max-height: 280px; overflow-y: auto; padding: 4px; }
.user-picker-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: transparent; text-align: left;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-family: inherit;
}
.user-picker-opt:hover, .user-picker-opt.is-focus { background: #f1f5f9; }
.user-picker-opt-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-picker-opt-name-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0;
}
.user-picker-opt-name { font-size: 14px; color: #0f172a; }
.user-picker-opt-meta { font-size: 12px; color: var(--muted); }
.user-picker-supervisor-badge {
  display: inline-flex; align-items: center;
  flex-shrink: 0;
  font-size: 11px; font-weight: 600; line-height: 1.2;
  color: #0f4c81;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}
.user-picker-supervisor-badge--chip {
  padding: 1px 5px;
  font-size: 10px;
  letter-spacing: 0.02em;
}
.user-picker-hl { background: #fef08a; color: inherit; padding: 0 1px; border-radius: 2px; }
.user-picker-empty { margin: 12px 10px; font-size: 13px; color: var(--muted); }
.user-picker-hidden { display: none; }

/* User list compact (bang phan quyen) */
.user-list-cell { min-width: 280px; max-width: 420px; vertical-align: top; }
.user-list-compact { position: relative; display: inline-block; max-width: 100%; }
.user-list-compact-tags {
  display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center;
  line-height: 1.35; max-width: 400px;
}
.user-list-tag {
  display: inline-block; background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 6px; padding: 2px 8px; font-size: 13px; color: #334155;
  white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
}
.user-list-more {
  border: 1px dashed #cbd5e1; background: #fff; color: #64748b;
  border-radius: 6px; padding: 2px 10px; font-size: 14px; line-height: 1.3;
  cursor: pointer; font-family: inherit; position: relative; z-index: 2;
}
.user-list-more:hover { background: #f8fafc; border-color: #94a3b8; color: #334155; }
.user-list-flyout {
  position: fixed; z-index: 9999;
  min-width: 220px; max-width: 360px; background: #fff;
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15,23,42,.14); padding: 10px 12px;
}
.user-list-cell { overflow: visible; }
.tablewrap { overflow-x: auto; overflow-y: visible; max-width: 100%; }
.user-list-popover-title {
  font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px;
}
.user-list-popover-tags { display: flex; flex-wrap: wrap; gap: 6px 8px; max-height: 240px; overflow-y: auto; }
.req { color: #dc2626; }
.field.is-invalid,
.grid-field.is-invalid {
  outline: 2px solid #fca5a5;
  outline-offset: 2px;
  border-radius: 10px;
  background: #fff7f7;
}
.form-required-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  margin-bottom: 12px;
}
.grid-field { border: 1px dashed var(--border); border-radius: 10px; padding: 12px; background: #fbfdff; }
.grid-field > label { color: var(--primary); }
.add-row { margin-top: 8px; }
.grid-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.paste-panel { margin-top: 10px; padding: 10px; border: 1px dashed var(--border); border-radius: 8px; background: #f8fafc; }
.paste-area { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.dup-row { color: var(--primary); }
.file-cur { font-size: 13px; margin-bottom: 6px; }
.file-input { padding: 6px; }
.inv-sum { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.approval-form { margin-top: 16px; }
.coding-ma-approval { margin-bottom: 16px; }
.coding-ma-table .ma-approval-inp { min-width: 160px; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.detail-head h3 { margin: 0; }
.detail-head p { margin: 4px 0 0; }

/* Logs / messages */
.log { margin-top: 12px; text-align: left; font-size: 13px; }
.log-line { padding: 3px 0; color: #334155; }
.log-line.err { color: #b91c1c; }

.setup-card { max-width: 720px; margin: 0 auto; text-align: left; }
.setup-card h3 { text-align: center; }
.setup-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.setup-audit { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e2e8f0; }
.setup-audit h4 { margin: 0 0 8px; font-size: 15px; }
.setup-audit-list { margin: 12px 0; display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow: auto; }
.setup-audit-item { padding: 10px 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; font-size: 13px; }
.setup-audit-item strong { display: block; margin: 4px 0 2px; }
.warn-text { color: #b45309; font-size: 14px; }
.ok-text { color: #166534; font-weight: 600; }
.err-text { color: #dc2626; font-weight: 600; }

/* Table row visibility (filter + pagination) */
tr.filter-hidden, tr.page-hidden { display: none !important; }

/* Pagination */
.pager-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.pager-bar[hidden] { display: none !important; }
.pager-info { font-size: 13px; color: var(--muted); }
.pager-ctrl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager-num { font-size: 13px; font-weight: 600; min-width: 64px; text-align: center; }
.btn.sm, button.mini.sm { padding: 4px 10px; font-size: 12px; }
.approval-error { border-color: #fecaca; background: #fef2f2; }

/* Busy CTA */
button.is-busy, .btn.is-busy, a.btn.is-busy {
  opacity: 0.65; pointer-events: none; cursor: wait;
}
.btn-spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: app-spin .7s linear infinite;
  vertical-align: middle;
}

/* Loading overlay */
.app-loading {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.35); backdrop-filter: blur(1px);
}
.app-loading[hidden] { display: none !important; }
.app-loading-box {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: #fff; border-radius: 12px; padding: 20px 28px;
  box-shadow: 0 10px 40px rgba(0,0,0,.15); min-width: 180px;
}
.app-spinner {
  width: 36px; height: 36px; border: 3px solid #e2e8f0;
  border-top-color: var(--primary); border-radius: 50%;
  animation: app-spin .7s linear infinite;
}
.app-loading-text { font-size: 14px; color: #334155; font-weight: 500; }
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  padding: 32px 16px;
}
.page-loading-text { font-size: 14px; color: #64748b; font-weight: 500; }
@keyframes app-spin { to { transform: rotate(360deg); } }

.ref-doc-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ref-doc-picks .input { flex: 1 1 200px; min-width: 160px; }

.access-debug {
  border: 1px dashed #f59e0b;
  border-radius: 12px;
  padding: 12px 14px 14px;
  background: #fffbeb;
}
.access-debug-meta { font-size: 12px; color: var(--muted); margin: 0 4px 10px; }
.access-debug-tbl { font-size: 12px; }
.access-debug-tbl code { font-size: 11px; }
.dbg-ok { color: #15803d; font-weight: 700; }
.dbg-deny { color: #b91c1c; font-weight: 700; }
.dbg-err { color: #c2410c; font-weight: 700; }
.access-debug-raw { margin: 10px 0; font-size: 12px; }
.access-debug-raw pre {
  max-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
}
.access-debug .btn { margin-top: 8px; margin-right: 6px; }

body.is-loading { cursor: wait; }
body.is-loading .wrap { pointer-events: none; opacity: 0.65; }

/* Scroll to top */
.scroll-top-btn {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 1200;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: var(--primary, #2563eb);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s, visibility .2s, transform .2s, background .15s;
}
.scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-top-btn:hover { background: #1d4ed8; }
.scroll-top-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

/* UI Kit — sortable / module & workflow builder */
.ui-drag-handle { cursor: grab; user-select: none; color: #8a94a3; padding: 0 6px; }
.ui-sortable-row.ui-dragging { opacity: 0.55; }
.ui-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 9999;
}
.wf-board { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.wf-card {
  border: 1px solid #e4e8ee; border-radius: 8px; padding: 12px; min-width: 200px;
  display: flex; flex-direction: column; gap: 8px; background: #fafbfc;
}
.wf-pipeline { margin: 16px 0; }
.wf-lane-main { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.wf-lane-failed { margin-top: 20px; padding-top: 12px; border-top: 1px dashed #e2e8f0; }
.wf-approvals-track { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.wf-node-fixed { min-width: 140px; padding: 12px; border-radius: 8px; background: #f1f5f9; border: 1px solid #e2e8f0; }
.wf-node-success { background: #ecfdf5; border-color: #86efac; }
.wf-node-danger { background: #fef2f2; border-color: #fca5a5; }
.wf-node-head { font-weight: 600; margin-bottom: 4px; }
.wf-arrow-h { color: #94a3b8; font-size: 20px; align-self: center; padding: 0 4px; }
.wf-approval-card { min-width: 280px; max-width: 360px; }
.wf-card-head { display: flex; align-items: center; gap: 8px; }
.wf-card-actions { margin-left: auto; display: flex; gap: 4px; }
.wf-conds { border-top: 1px solid #e8ecf0; padding-top: 8px; margin-top: 4px; }
.wf-conds-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; }
.wf-cond-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; align-items: flex-start; }
.wf-cond-row .drawer-cond-field { flex: 1 1 150px; min-width: 140px; }
.wf-cond-row .drawer-cond-op { flex: 0 0 92px; width: 92px; }
.wf-cond-row .drawer-cond-del { flex: 0 0 32px; padding: 4px 8px; }
.wf-cond-val-wrap { flex: 1 1 200px; min-width: 160px; }
.wf-cond-val-wrap .drawer-cond-val { width: 100%; }
.wf-cond-chip-filter { margin-bottom: 6px; width: 100%; }
.wf-cond-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 132px;
  overflow-y: auto;
  padding: 2px 0;
}
.wf-cond-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f2f5f9;
  border: 1px solid #dde3ea;
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  line-height: 1.3;
}
.wf-cond-chip input { margin: 0; }
.wf-cond-chip:has(input:checked) {
  background: #e7f0ff;
  border-color: #a9c6ff;
  color: #1a56db;
}
.wf-cond-row .wf-cond-user-picker { font-weight: 400; }
.wf-cond-row .user-picker-combo { background: #fff; }
.wf-drawer-hint { margin: 0 0 10px; line-height: 1.45; }
.mod-tabs {
  display: flex; gap: 4px; margin: 14px 0 8px; padding: 4px;
  border: 1px solid var(--border); border-radius: 12px; background: #f3f6fb;
  overflow-x: auto;
}
.mod-tab {
  background: transparent; border: none; padding: 9px 14px; cursor: pointer;
  color: var(--muted); border-radius: 9px; font-family: inherit; font-size: 13px;
  font-weight: 600; white-space: nowrap; transition: background 0.15s, color 0.15s;
}
.mod-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.7); }
.mod-tab.active {
  color: var(--primary-d); background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.mod-tab-link {
  text-decoration: none; display: inline-block; padding: 9px 14px;
  color: var(--muted); border-radius: 9px; font-weight: 600;
}
.mod-tab-link:hover { color: var(--primary); background: rgba(255, 255, 255, 0.7); }
.mod-panel { display: none; padding: 14px 2px 4px; }
.mod-panel.active { display: block; animation: panel-in 0.22s var(--ease); }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.mod-save-bar { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }
.mod-actions-bar {
  border-top: 1px solid var(--border); padding-top: 16px; margin-top: 18px;
  position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(255,255,255,0.88), #fff);
  backdrop-filter: blur(8px); z-index: 2;
}
.mod-list-card { margin-bottom: 14px; }
.mod-list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.mod-list-head h3 { margin: 0; }
.mod-editor-card { margin-top: 0; }
.mod-row-selected { background: #eef6fc; }
.mod-row-selected td { border-color: #c5ddf3; }
.mod-divider { border: none; border-top: 1px dashed var(--border); margin: 18px 0; }
.mod-grids-stack { display: flex; flex-direction: column; gap: 16px; margin: 12px 0; }
.mod-grid-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; background: linear-gradient(180deg, #fcfdff, #f6f8fc);
}
.mod-grid-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.mod-grid-card-head h4 { margin: 0; font-size: 14px; color: #334155; font-weight: 700; }
.mod-grid-card .field { margin-bottom: 8px; }
.is-hidden { display: none !important; }
.inline-check { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.field.inline-check { flex-direction: row; }
.muted.sm { font-size: 12px; }

/* Workflow editor board + drawer */
.wf-editor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.wf-status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: #e2e8f0; text-transform: uppercase; }
.wf-status-pill.published { background: #dcfce7; color: #166534; }
.wf-status-pill.draft { background: #fef3c7; color: #92400e; }
.wf-pipeline-board { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px; margin-bottom: 12px; overflow: visible; }
.wf-board-main {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
}
.wf-board-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.wf-board-row { display: flex; align-items: stretch; gap: 8px; flex-wrap: nowrap; min-width: min-content; }
.wf-board-end {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
  margin-left: 4px;
  border-left: 1px dashed #cbd5e1;
  background: linear-gradient(90deg, #f8fafc 0%, #f0fdf4 40%);
  border-radius: 0 8px 8px 0;
  z-index: 2;
}
.wf-board-arrow-end { color: #16a34a; }
.wf-board-failed-row { margin-top: 16px; display: flex; align-items: center; gap: 12px; }
.wf-board-arrow { color: #94a3b8; font-size: 22px; align-self: center; flex-shrink: 0; }
.wf-board-arrow-down { color: #94a3b8; font-size: 13px; }
.wf-fixed-col { min-width: 110px; padding: 14px 12px; border-radius: 8px; text-align: center; border: 2px solid #e2e8f0; background: #fff; flex-shrink: 0; }
.wf-col-draft { border-color: #cbd5e1; }
.wf-col-complete { border-color: #86efac; background: #f0fdf4; }
.wf-col-complete .btn { margin-top: 8px; }
.wf-drawer-panel.is-complete .wf-approval-only { display: none !important; }
.wf-col-failed { border-color: #fca5a5; background: #fef2f2; }
.wf-col-icon { font-size: 22px; margin-bottom: 4px; }
.wf-col-title, .wf-step-col-title { font-weight: 600; font-size: 14px; }
.wf-col-sub { font-size: 12px; }
.wf-approvals-cols { display: flex; gap: 10px; align-items: stretch; flex-wrap: nowrap; }
.wf-step-col {
  width: 200px; min-width: 180px; max-width: 220px; padding: 12px; border-radius: 8px;
  border: 2px solid #93c5fd; background: #fff;
  display: flex; flex-direction: column; gap: 6px; flex-shrink: 0;
  position: relative; z-index: 1; overflow: hidden;
}
.wf-step-col-head { display: flex; align-items: center; gap: 6px; }
.wf-step-num { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 0.03em; }
.wf-step-col-status { font-size: 12px; }
.wf-step-col-summary { font-size: 11px; color: #64748b; line-height: 1.4; flex: 1; }
.wf-meta { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.wf-meta-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.wf-meta-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-meta-chip-rule { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.wf-meta-chip-skip { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.wf-meta-chip-notify { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.wf-meta-chip-mute { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.wf-meta-rules {
  margin: 0;
  padding: 0 0 0 14px;
  font-size: 10px;
  color: #334155;
  line-height: 1.35;
}
.wf-meta-rules li { margin: 0 0 3px; }
.wf-meta-rule-name { color: #64748b; font-style: normal; font-weight: 600; }
.wf-meta-if { color: #475569; }
.wf-meta-more { color: #94a3b8; list-style: none; margin-left: -14px !important; }
.wf-meta-hint { margin: 0; font-size: 10px; color: #b45309; }
.wf-meta-skip-line {
  margin: 0;
  font-size: 10px;
  color: #9a3412;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wf-step-col-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.wf-board-toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e2e8f0;
}
.wf-board-toolbar .btn { flex-shrink: 0; }

.wf-drawer { position: fixed; inset: 0; z-index: 10000; }
.wf-drawer[hidden] { display: none !important; }
.wf-drawer-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
.wf-drawer-panel { position: absolute; top: 0; right: 0; width: min(520px, 100vw); height: 100%; background: #fff; box-shadow: -4px 0 24px rgba(0,0,0,0.12); display: flex; flex-direction: column; }
.wf-drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; }
.wf-flow-section { margin: 20px 0 12px; padding-top: 16px; border-top: 1px solid #e2e8f0; }
.wf-flow-section h4 { margin: 0 0 6px; }
.wf-flow-canvas-wrap { position: relative; min-height: 200px; padding: 16px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; overflow: auto; }
.wf-flow-svg { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 0; }
.wf-flow-blocks { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.wf-flow-block {
  min-width: 150px; max-width: 200px; padding: 12px; border-radius: 10px; border: 2px solid #e2e8f0;
  background: #fff; transition: box-shadow .15s, border-color .15s;
}
.wf-flow-block.is-drop-hover { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.wf-flow-draft { border-color: #cbd5e1; }
.wf-flow-approval { border-color: #93c5fd; }
.wf-flow-complete { border-color: #86efac; background: #f0fdf4; }
.wf-flow-failed { border-color: #fca5a5; background: #fef2f2; }
.wf-flow-block-icon { font-size: 22px; text-align: center; margin-bottom: 4px; }
.wf-flow-block-title { font-weight: 600; font-size: 14px; text-align: center; margin-bottom: 8px; }
.wf-flow-ports { display: flex; flex-direction: column; gap: 6px; }
.wf-flow-port {
  font-size: 12px; padding: 6px 8px; border-radius: 6px; cursor: grab; user-select: none;
  border: 1px dashed #cbd5e1; background: #fff;
}
.wf-flow-port.is-dragging { opacity: 0.55; cursor: grabbing; }
.wf-port-submit { border-color: #93c5fd; background: #eff6ff; }
.wf-port-approve { border-color: #86efac; background: #f0fdf4; }
.wf-port-reject { border-color: #fca5a5; background: #fef2f2; }
.wf-flow-routes { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.wf-flow-route { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.wf-flow-route-label { font-weight: 600; }
.wf-route-approve .wf-flow-route-label { color: #166534; }
.wf-route-reject .wf-flow-route-label { color: #b91c1c; }
.wf-route-submit .wf-flow-route-label { color: #1d4ed8; }
.wf-block-edit { margin-top: 8px; width: 100%; }
.wf-port-approve { color: #166534; }
.wf-port-reject { color: #b91c1c; }
.wf-port-submit { color: #1d4ed8; }
.wf-drawer-body { flex: 1; overflow-y: auto; overflow-x: visible; padding: 16px 20px; }
.wf-drawer-body .field { display: block; margin-bottom: 14px; font-weight: 600; font-size: 13px; color: #334155; }
.wf-drawer-body .field .input,
.wf-drawer-body .field .user-picker,
.wf-drawer-body .field .user-picker-bulk { font-weight: 400; margin-top: 5px; }
.wf-drawer-body .field-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: #334155; }
.wf-assignee-source {
  display: flex; flex-direction: column; gap: 8px; margin-top: 6px; font-weight: 400;
}
.wf-assignee-source-opt {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0; padding: 10px 12px;
  border: 1px solid #e2e8f0; border-radius: 10px;
  background: #fff; cursor: pointer; font-weight: 500; color: #0f172a;
}
.wf-assignee-source-opt:has(input:checked) {
  border-color: #93c5fd; background: #eff6ff;
}
.wf-assignee-source-opt input { margin-top: 2px; }
.wf-supervisor-info-box {
  margin-top: 6px; padding: 12px 14px;
  border: 1px solid #bae6fd; border-radius: 10px; background: #f0f9ff;
  font-weight: 400;
}
.wf-supervisor-info-box strong { color: #0f4c81; }
.wf-approver-box { font-weight: 400; margin-top: 5px; }
.wf-approver-bulk { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.wf-approver-selected { margin-bottom: 8px; min-height: 1.2em; }
.wf-approver-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; min-height: 8px;
}
.wf-approver-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #dbeafe; color: #1e3a8a; border-radius: 999px;
  padding: 4px 8px 4px 10px; font-size: 13px; font-weight: 500;
}
.wf-approver-chip button {
  border: 0; background: transparent; color: #64748b; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px;
}
.wf-approver-chip button:hover { color: #dc2626; }
.wf-approver-list {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
}
.wf-approver-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  margin: 0;
  font-weight: 400;
}
.wf-approver-row:last-child { border-bottom: none; }
.wf-approver-row:hover { background: #f8fafc; }
.wf-approver-row.is-checked { background: #eff6ff; }
.wf-approver-row input { margin-top: 3px; flex-shrink: 0; }
.wf-approver-row-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wf-approver-row-name { font-size: 14px; color: #0f172a; }
.wf-approver-row-name-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.wf-approver-row-meta { font-size: 12px; color: #64748b; }
.wf-approver-empty { padding: 16px 12px; color: #64748b; font-size: 13px; }
.wf-step-col-approvers {
  margin-top: 6px; font-size: 12px; color: #1d4ed8; line-height: 1.35; font-weight: 600;
  max-height: 2.8em; overflow: hidden;
}
.wf-step-col-approvers-warn { color: #b45309 !important; }
.wf-step-col-approvers-rules { color: #1d4ed8 !important; }
.wf-approver-role {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 2px;
  vertical-align: middle;
}
.wf-drawer-foot { padding: 12px 20px; border-top: 1px solid #e2e8f0; display: flex; gap: 8px; }
.wf-drawer-flags { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; padding: 10px; background: #f8fafc; border-radius: 8px; }
.wf-conds-block { margin-top: 16px; border-top: 1px solid #e2e8f0; padding-top: 12px; }
.wf-rules-block { margin-top: 16px; border-top: 1px solid #e2e8f0; padding-top: 12px; }
.wf-rule-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: #f8fafc;
}
.wf-rule-card-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.wf-rule-card-head .input { flex: 1; }
.wf-rule-conds { margin: 8px 0; }
.wf-rule-approvers {
  overflow: visible;
  background: transparent;
  padding: 0;
}
.wf-rule-approvers .user-picker { font-weight: 400; }
.wf-rule-approvers .user-picker-combo { background: #fff; }
body.wf-drawer-open { overflow: hidden; }
.wf-pill { font-size: 10px; padding: 1px 6px; border-radius: 4px; margin-left: 4px; }
.wf-pill.ok { background: #dcfce7; color: #166534; }
.wf-pill.warn { background: #fef3c7; color: #92400e; }
.warn-text { color: #b45309; background: #fffbeb; padding: 8px 12px; border-radius: 6px; margin-top: 8px; }

/* Wizard (module mới) */
.wiz-indicator { display: flex; align-items: center; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.wiz-dot { padding: 6px 12px; border-radius: 20px; background: #f1f5f9; font-size: 13px; color: #64748b; }
.wiz-dot.active { background: #3b82f6; color: #fff; font-weight: 600; }
.wiz-dot.done { background: #dcfce7; color: #166534; }
.wiz-arrow { color: #94a3b8; }
.wiz-panel { display: none; padding: 12px 0; }
.wiz-panel.active { display: block; }
.wiz-nav { display: flex; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid #e2e8f0; }
.wiz-preview { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 16px; }

/* Workflow list fallback */
.wf-list-view { display: none; }
.wf-list-view.active { display: block; }
.wf-pipeline-board.hidden { display: none; }
.wf-view-toggle { margin-bottom: 12px; display: flex; gap: 6px; }
.wf-view-toggle .btn.active { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; font-weight: 600; }
.wf-flow-section.hidden,
.wf-board-hint.hidden { display: none !important; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* Document meta + workflow track */
.doc-meta-row { display: flex; flex-wrap: wrap; gap: 16px; padding: 10px 12px; background: #f8fafc; border-radius: 8px; border: 1px solid var(--border); }
.doc-meta-item { font-size: 13px; }
.identity-banner { margin-bottom: 12px; padding: 10px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.list-owner-hint { margin: 0 0 10px; font-size: 13px; }
.workflow-track h4 { margin: 0; }
.workflow-track h5 { margin: 16px 0 8px; font-size: 13px; }
.wf-track-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.wf-track-status-pill {
  font-size: 12px; font-weight: 700; color: #1e40af;
  background: #dbeafe; border-radius: 999px; padding: 4px 10px;
}
.wf-track-next {
  display: flex; flex-direction: column; gap: 2px;
  margin: 0 0 14px; padding: 10px 12px;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
}
.wf-track-next-label { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.wf-track-next strong { font-size: 14px; color: #1d4ed8; }
.wf-track-list { list-style: none; margin: 0; padding: 0; }
.wf-track-item {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: stretch;
}
.wf-track-rail {
  position: relative; display: flex; flex-direction: column; align-items: center;
}
.wf-track-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: #e2e8f0; border: 2px solid #cbd5e1;
  flex-shrink: 0; z-index: 1; margin-top: 14px;
}
.wf-track-line {
  flex: 1; width: 2px; background: #e2e8f0; margin: 4px 0 0; min-height: 12px;
}
.wf-track-card {
  margin-bottom: 10px; padding: 12px 14px;
  border: 1px solid #e2e8f0; border-radius: 12px; background: #fff;
}
.wf-track-card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.wf-track-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wf-track-label { font-size: 14px; color: #0f172a; }
.wf-track-sub { font-size: 12px; color: #64748b; }
.wf-track-badge {
  flex-shrink: 0; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
  background: #f1f5f9; color: #64748b; white-space: nowrap;
}
.wf-track-people {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 8px; font-size: 13px; color: #334155; line-height: 1.35;
}
.wf-track-people-ic { flex-shrink: 0; opacity: 0.7; }
.wf-track-acted { margin-top: 6px; font-size: 12px; }
.wf-track-time { margin-top: 4px; font-size: 12px; color: #64748b; }

.wf-track-item.is-done .wf-track-dot { background: #22c55e; border-color: #16a34a; }
.wf-track-item.is-done .wf-track-line { background: #86efac; }
.wf-track-item.is-done .wf-track-card { border-color: #bbf7d0; background: #f0fdf4; }
.wf-track-item.is-done .wf-track-badge { background: #dcfce7; color: #166534; }

.wf-track-item.is-current .wf-track-dot {
  background: #2563eb; border-color: #1d4ed8;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}
.wf-track-item.is-current .wf-track-card {
  border-color: #93c5fd; background: linear-gradient(180deg, #eff6ff, #fff);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}
.wf-track-item.is-current .wf-track-badge { background: #dbeafe; color: #1d4ed8; }
.wf-track-item.is-current .wf-track-label { color: #1e40af; }

.wf-track-item.is-pending .wf-track-card { opacity: 0.78; }
.wf-track-item.is-pending .wf-track-badge { background: #f8fafc; color: #94a3b8; }

.wf-track-item.is-rejected .wf-track-dot { background: #ef4444; border-color: #dc2626; }
.wf-track-item.is-rejected .wf-track-card { border-color: #fecaca; background: #fef2f2; }
.wf-track-item.is-rejected .wf-track-badge { background: #fee2e2; color: #b91c1c; }

/* Bước bỏ qua (điều kiện / không người duyệt) */
.wf-track-item.is-skipped .wf-track-dot {
  background: #f59e0b; border-color: #d97706;
  position: relative;
}
.wf-track-item.is-skipped .wf-track-dot::after {
  content: '';
  position: absolute; inset: 4px;
  border-radius: 50%;
  background: #fffbeb;
}
.wf-track-item.is-skipped .wf-track-line { background: #fcd34d; }
.wf-track-item.is-skipped .wf-track-card {
  border-color: #fde68a; background: #fffbeb;
  border-style: dashed;
}
.wf-track-item.is-skipped .wf-track-badge { background: #fef3c7; color: #b45309; }
.wf-track-item.is-skipped .wf-track-label { color: #92400e; text-decoration: line-through; text-decoration-thickness: 1px; }
.wf-track-item.is-skipped .wf-track-sub { color: #a16207; }
.wf-track-skip-hint {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 8px; font-size: 12px; color: #a16207; line-height: 1.35;
}
.wf-track-skip-ic { flex-shrink: 0; font-weight: 700; opacity: 0.85; }

.wf-pending { margin: 12px 0 0; padding: 8px 10px; background: #eff6ff; border-radius: 8px; font-size: 13px; }
.appr-v2-meta p { margin: 4px 0; }
.appr-next-approver { margin-top: 4px; font-size: 13px; color: #1d4ed8; font-weight: 600; }
.appr-next-banner { margin-bottom: 12px; background: #eff6ff; border-color: #bfdbfe; }
.appr-next-banner .appr-next-approver { margin: 8px 0 4px; }
.appr-next-pill {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px;
  max-width: 100%; padding: 5px 10px; border-radius: 999px;
  background: #e2e8f0; color: #334155; font-size: 12px; font-weight: 600;
  line-height: 1.25;
}
.appr-next-pill-wait {
  background: #eff6ff; color: #1d4ed8;
  box-shadow: none;
}
.appr-next-pill-reject {
  background: #dc2626; color: #fff; font-weight: 700;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.28);
}
.appr-next-pill .appr-next-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; background: rgba(15, 23, 42, 0.08);
  font-size: 11px; flex-shrink: 0;
}
.appr-next-pill-reject .appr-next-ic { background: rgba(255,255,255,.22); }
.appr-status-cell .appr-status-text { font-weight: 600; color: #0f172a; }
.appr-status-reject { color: #b91c1c !important; }
.appr-step-fields {
  margin-bottom: 16px;
  padding: 14px 14px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #f8fbff;
}
.appr-step-fields.is-focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.appr-step-fields h4 { margin: 0 0 4px; font-size: 15px; color: #1e40af; }
.appr-step-fields .hint { margin: 0 0 12px; }
.appr-step-fields .field { margin-bottom: 12px; }
.appr-reject-banner strong { color: #991b1b; display: block; margin-bottom: 4px; }
.appr-reject-banner p { margin: 4px 0 0; font-size: 13px; color: #7f1d1d; }
.wf-track-status-pill.is-failed {
  background: #fee2e2; color: #991b1b; border-color: #fecaca;
}
/* Searchable select */
.search-select {
  position: relative;
  display: inline-block;
  min-width: 260px;
  max-width: 100%;
  vertical-align: middle;
}
.search-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
.search-select-trigger {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  min-height: 38px;
}
.search-select-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.search-select-caret { color: #94a3b8; font-size: 12px; flex-shrink: 0; }
.search-select.is-open .search-select-trigger {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.search-select-panel {
  position: absolute;
  z-index: 40;
  left: 0; right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  min-width: 280px;
}
.search-select-search { padding: 8px; border-bottom: 1px solid #f1f5f9; }
.search-select-q { width: 100%; margin: 0; }
.search-select-list {
  list-style: none; margin: 0; padding: 6px;
  max-height: 280px; overflow: auto;
}
.search-select-group {
  font-size: 11px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 8px 10px 4px;
}
.search-select-option {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: #0f172a;
}
.search-select-option:hover { background: #f1f5f9; }
.search-select-option.is-selected { background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.search-select-opt-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.search-select-opt-code {
  flex-shrink: 0; font-size: 11px; color: #94a3b8;
  font-family: ui-monospace, Menlo, monospace;
}
.search-select-empty { padding: 14px 12px; text-align: center; font-size: 13px; }
.search-select.is-sm { min-width: 180px; }
.fc-modbar .search-select { min-width: 320px; flex: 1 1 280px; max-width: 520px; }
.toolbar .search-select { min-width: 200px; }

/* ===== UI polish layer (2026) ===== */
.identity-banner, .warn-banner {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.identity-banner {
  background: linear-gradient(90deg, #eef6fc, #f7fbff);
  border-color: #c9dff4;
}
.warn-banner {
  background: linear-gradient(90deg, #fff7ed, #fffbeb);
  border-color: #f6d687;
  color: #9a3412;
}
.ok-text {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 10px; margin: 0 0 12px;
  background: #ecfdf5; color: #166534; border: 1px solid #bbf7d0; font-weight: 600;
}
.err-text {
  display: block; padding: 8px 12px; border-radius: 10px; margin: 0 0 12px;
  background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; font-weight: 600;
}
.badge {
  border: 1px solid transparent;
  letter-spacing: 0.01em;
}
.fc-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.fc-table th, .fc-table td { padding: 8px 8px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.fc-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: #64748b; font-weight: 700; background: transparent;
}
.fc-table .input { min-width: 0; }
.ui-row-actions { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.ui-row-actions .btn { width: 100%; }
.ui-drag-handle {
  cursor: grab; color: #94a3b8; font-size: 16px;
  transition: color 0.12s;
}
.ui-drag-handle:hover { color: var(--primary); }
.ui-toast {
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.22);
  font-weight: 600;
}
.wf-pill {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wf-pill.ok { background: #dcfce7; color: #166534; }
.wf-pill.warn { background: #fef3c7; color: #92400e; }
.form-actions {
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  margin-top: 16px;
}
.list-owner-hint {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
}
.grid-field {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: #f8fafc;
}
.grid-field > .muted, .grid-field-title {
  font-weight: 700;
  margin-bottom: 8px;
}
@media (max-width: 720px) {
  .wrap { padding: 12px 10px 28px; }
  .topbar { border-radius: 12px; padding: 10px 12px; }
  .home-btn { font-size: 12.5px; padding: 8px 10px; }
  .uinfo { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .mod-actions-bar { position: static; }
}


.app-loading-box { border-radius: var(--radius); border: 1px solid var(--border); }
.app-loading { background: rgba(15, 23, 42, 0.28); backdrop-filter: blur(3px); }
.wf-pipeline-board, .wf-flow-canvas-wrap {
  background: linear-gradient(180deg, #f8fafc, #f1f5f9) !important;
  border-radius: var(--radius-sm) !important;
}
.appr-bulk-dock {
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff, #f3f6fb) !important;
}
