/* ==========================================================================
   BPMN Mining — hệ thống giao diện
   Không dùng font/CDN ngoài để trang chạy được cả khi không có Internet
   và để Content-Security-Policy giữ được mức chặt nhất.
   ========================================================================== */

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #16222e;
  --ink-soft: #3d4d5c;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff4ff;
  --ok: #15803d;
  --ok-soft: #e9f7ee;
  --warn: #b45309;
  --warn-soft: #fdf4e3;
  --danger: #b3262e;
  --danger-soft: #fdecec;
  --accent: #0f766e;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(16, 34, 46, .06), 0 4px 14px rgba(16, 34, 46, .05);
  --shadow-lg: 0 10px 30px rgba(16, 34, 46, .12);
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  /* clip thay vì hidden: không tạo scroll container nên .topbar sticky vẫn chạy */
  overflow-x: clip;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }

code, pre, .mono { font-family: var(--mono); font-size: .86em; }

.container { width: min(1400px, 100% - 2.5rem); margin-inline: auto; }
.container-narrow { width: min(560px, 100% - 2.5rem); margin-inline: auto; }
.container-mid { width: min(900px, 100% - 2.5rem); margin-inline: auto; }

.muted { color: var(--muted); }
.small { font-size: .86rem; }
.tiny { font-size: .78rem; }
.strong { font-weight: 650; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; gap: .35rem; align-items: center; }
.spacer { flex: 1; }

/* ------------------------------------------------------------ thanh điều hướng */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.topbar-inner { display: flex; align-items: center; gap: 1rem; height: 58px; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700;
         color: var(--ink); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; display: block; flex: none;
}
.nav-links { display: flex; gap: .3rem; align-items: center; margin-left: .5rem; }
.nav-links a { padding: .38rem .7rem; border-radius: 8px; color: var(--ink-soft);
               font-size: .92rem; }
.nav-links a:hover { background: var(--surface-2); text-decoration: none; }
.nav-links a.active { background: var(--brand-soft); color: var(--brand-dark);
                      font-weight: 600; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-dark); display: grid; place-items: center; font-size: .78rem;
  font-weight: 700; border: 1px solid #dbe4fb;
}

/* -------------------------------------------------------------------- nút bấm */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  padding: .5rem .9rem; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem;
  font-weight: 550; cursor: pointer; transition: background .15s, border-color .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--danger); border-color: #f0c9c9; background: var(--danger-soft); }
.btn-danger:hover { background: #fbdcdc; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; border-radius: 7px; }
.btn-block { width: 100%; }

/* -------------------------------------------------------------------- thẻ/khối */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.card-pad { padding: 1.1rem 1.2rem; }
.card-head {
  padding: .8rem 1.1rem; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .6rem;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 1.1rem; }

.page-head { display: flex; align-items: flex-start; gap: 1rem; margin: 1.4rem 0 1rem; }
.page-head h1 { margin: 0; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }

/* ------------------------------------------------------------------ chỉ số */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
           gap: .8rem; }
.metric {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem .9rem;
}
.metric .label { font-size: .78rem; color: var(--muted); text-transform: uppercase;
                 letter-spacing: .03em; }
.metric .value { font-size: 1.32rem; font-weight: 680; margin-top: .15rem;
                 line-height: 1.2; }
.metric .hint { font-size: .76rem; color: var(--muted); margin-top: .25rem; }
.metric.accent { border-color: #c7d7fb; background: linear-gradient(180deg, #fbfcff, #f4f7ff); }

/* -------------------------------------------------------------------- nhãn */
.badge {
  display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .5rem;
  border-radius: 999px; font-size: .76rem; font-weight: 600; border: 1px solid transparent;
}
.badge-blue { background: var(--brand-soft); color: var(--brand-dark); border-color: #d6e2fd; }
.badge-green { background: var(--ok-soft); color: var(--ok); border-color: #cdeed9; }
.badge-amber { background: var(--warn-soft); color: var(--warn); border-color: #f6e2bd; }
.badge-red { background: var(--danger-soft); color: var(--danger); border-color: #f4cccc; }
.badge-grey { background: var(--surface-2); color: var(--muted); border-color: var(--line); }

/* -------------------------------------------------------------------- thông báo */
.alert { border-radius: var(--radius); padding: .7rem .9rem; border: 1px solid;
         font-size: .9rem; }
.alert + .alert { margin-top: .5rem; }
.alert-info { background: var(--brand-soft); border-color: #d6e2fd; color: #1e40af; }
.alert-success { background: var(--ok-soft); border-color: #cdeed9; color: #14532d; }
.alert-warning { background: var(--warn-soft); border-color: #f6e2bd; color: #7c2d12; }
.alert-error { background: var(--danger-soft); border-color: #f4cccc; color: #7f1d1d; }
.flash-stack { margin: .9rem 0; }

/* -------------------------------------------------------------------- biểu mẫu */
.field { margin-bottom: .85rem; }
.field label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: .28rem;
               color: var(--ink-soft); }
.input, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--line-strong);
  border-radius: 8px; font: inherit; font-size: .92rem; background: var(--surface);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 80px; }
.field-error { color: var(--danger); font-size: .8rem; margin-top: .22rem; }
.field-hint { color: var(--muted); font-size: .8rem; margin-top: .22rem; }
.checkline { display: flex; gap: .5rem; align-items: flex-start; font-size: .88rem; }
.checkline input { width: auto; margin-top: .25rem; }

/* -------------------------------------------------------------------- bảng */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th, table.data td { padding: .45rem .6rem; border-bottom: 1px solid var(--line);
                               text-align: left; vertical-align: middle; }
table.data th { font-size: .76rem; text-transform: uppercase; letter-spacing: .03em;
                color: var(--muted); font-weight: 650; background: var(--surface-2);
                position: sticky; top: 0; z-index: 1; }
table.data tbody tr:hover { background: #fbfdff; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data input, table.data select { padding: .28rem .4rem; font-size: .85rem;
                                      border-radius: 6px; }
table.data .cell-narrow { width: 84px; }
table.data .cell-mid { width: 120px; }

/* -------------------------------------------------------------------- danh sách quy trình */
.process-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
                gap: .9rem; }
.process-card { display: flex; flex-direction: column; gap: .5rem; padding: 1rem 1.05rem; }
.process-card h3 { margin: 0; font-size: 1.02rem; }
.process-card .meta { font-size: .8rem; color: var(--muted); }
.process-card .actions { display: flex; gap: .35rem; margin-top: auto; padding-top: .5rem; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state h3 { color: var(--ink); }

/* -------------------------------------------------------------------- tabs */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin: 1.1rem 0 0; }
.tab {
  padding: .55rem .95rem; border: none; background: none; font: inherit; font-size: .92rem;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  font-weight: 550; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--brand-dark); border-bottom-color: var(--brand); }
.tab-panel { padding-top: 1rem; }

/* -------------------------------------------------------------------- sơ đồ */
.diagram-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(468px, .95fr);
                  gap: 1rem; align-items: start; }
@media (max-width: 1240px) { .diagram-layout { grid-template-columns: 1fr; } }

.diagram-toolbar {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  padding: .55rem .8rem; border-bottom: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.diagram-frame {
  overflow: auto; max-width: 100%; background: #fff; padding: 10px; max-height: 70vh;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.diagram-frame svg { display: block; height: auto; }
.diagram-frame.fit svg { max-width: 100%; }
.diagram-frame:not(.fit) svg { max-width: none; }

.legend { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted);
          padding: .5rem .8rem 0; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block;
               margin-right: .3rem; vertical-align: -1px; border: 1px solid rgba(0,0,0,.15); }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px;
       overflow: hidden; }
.seg button {
  border: none; background: var(--surface); padding: .32rem .62rem; font: inherit;
  font-size: .82rem; cursor: pointer; color: var(--ink-soft);
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem;
          color: var(--ink-soft); cursor: pointer; }
.switch input { width: auto; }

/* -------------------------------------------------------------------- bộ soạn thảo */
/* Bo cuc tren-duoi cho tab so do: so do chiem het chieu ngang, bang buoc nam duoi */
.stacked-layout { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.stacked-layout > * { min-width: 0; max-width: 100%; }
.stacked-layout .diagram-frame { max-height: 52vh; }
.stacked-layout .editor-panel { position: static; }
.stacked-layout .editor-body { max-height: min(74vh, 820px); }
.stacked-layout .editor-body table.data { min-width: 0; }
/* Rong roi hon nen "Loai" xep ngang thay vi chong len nhau */
.stacked-layout .editor-body .cell-type { flex-direction: row; align-items: center;
                                          min-width: 250px; }
.stacked-layout .editor-body .cell-type select { flex: 1; }

.editor-panel { position: sticky; top: 74px; }
.editor-tabs { display: flex; gap: .2rem; padding: .5rem .6rem 0; }
.editor-body { padding: .6rem; max-height: 58vh; overflow: auto; }
.editor-body table.data { min-width: 452px; }
.editor-body table.data th { font-size: .68rem; }
.editor-body table.data td { padding: .3rem .35rem; }
.editor-body table.data input,
.editor-body table.data select { width: 100%; min-width: 0; }
.editor-body .cell-type { min-width: 122px; display: flex; flex-direction: column; gap: 3px; }
.editor-body .cell-id input { font-family: var(--mono); font-size: .78rem; }
.editor-foot {
  display: flex; gap: .5rem; align-items: center; padding: .6rem .8rem;
  border-top: 1px solid var(--line); background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.xml-editor { width: 100%; min-height: 46vh; font-family: var(--mono); font-size: .8rem;
              line-height: 1.5; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.drag-handle { cursor: grab; color: var(--line-strong); user-select: none;
               text-align: center; width: 26px; font-size: 1rem; }
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: .45; }
tr.drop-target td { border-top: 2px solid var(--brand); }

.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn);
             display: inline-block; }
.save-state { font-size: .82rem; color: var(--muted); }

/* -------------------------------------------------------------------- công thức */
.formula {
  background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 8px; padding: .55rem .7rem; font-family: var(--mono); font-size: .82rem;
  overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}
.formula-cost { border-left-color: var(--accent); }
.model-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
               gap: .7rem; }
.rule { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
        padding: .7rem .8rem; }
.rule .eq { font-family: var(--mono); font-size: .88rem; color: var(--brand-dark);
            font-weight: 600; margin-bottom: .2rem; }
.rule .why { font-size: .82rem; color: var(--muted); }

.scenario { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .6rem;
            background: var(--surface); }
.scenario summary { padding: .6rem .8rem; cursor: pointer; display: flex; gap: .6rem;
                    align-items: center; flex-wrap: wrap; font-size: .9rem; }
.scenario summary::-webkit-details-marker { display: none; }
.scenario summary::before { content: "▸"; color: var(--muted); }
.scenario[open] summary::before { content: "▾"; }
.scenario .body { padding: 0 .8rem .8rem; }
.path-chain { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center;
              font-size: .82rem; }
.path-chain .step { background: var(--surface-2); border: 1px solid var(--line);
                    border-radius: 6px; padding: .12rem .4rem; }
.path-chain .arrow { color: var(--muted); }

/* -------------------------------------------------------------------- biểu đồ */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding-top: .5rem; }
.bar { flex: 1; background: linear-gradient(180deg, #93b4f7, var(--brand)); border-radius: 3px 3px 0 0;
       min-height: 2px; position: relative; }
.bar:hover { background: var(--brand-dark); }
.bar-axis { display: flex; justify-content: space-between; font-size: .72rem;
            color: var(--muted); margin-top: .3rem; }

.meter { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); }

main { padding-bottom: 1.6rem; }

/* --------------------------------------------------- nút hành động ở chân trang */
.footer-action {
  display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-soft); font: inherit; font-size: .82rem; font-weight: 600;
  cursor: pointer;
}
.footer-action:hover { background: var(--brand-soft); border-color: #c7d7fb;
                       color: var(--brand-dark); }

/* -------------------------------------------------------------------- dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary::marker { content: ""; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 236px; padding: .35rem; display: flex; flex-direction: column; gap: 1px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.dropdown-menu a {
  display: block; padding: .42rem .6rem; border-radius: 7px; font-size: .87rem;
  color: var(--ink); white-space: nowrap;
}
.dropdown-menu a:hover { background: var(--brand-soft); color: var(--brand-dark);
                         text-decoration: none; }
.dropdown-menu .menu-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: .4rem .6rem .15rem;
}
.dropdown-menu hr { border: none; border-top: 1px solid var(--line); margin: .25rem 0; }

dialog.modal {
  border: none; border-radius: var(--radius-lg); padding: 0; width: min(560px, 94vw);
  box-shadow: var(--shadow-lg); color: var(--ink);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal-head { padding: .9rem 1.1rem; border-bottom: 1px solid var(--line);
              display: flex; align-items: center; gap: .6rem; }
.confirm-icon {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: .9rem;
  background: var(--brand-soft); color: var(--brand-dark);
}
.confirm-icon.danger { background: var(--danger-soft); color: var(--danger); }
.modal-body { padding: 1.1rem; }
.modal-foot { padding: .8rem 1.1rem; border-top: 1px solid var(--line);
              display: flex; gap: .5rem; justify-content: flex-end; background: var(--surface-2);
              border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* -------------------------------------------------------------------- footer */
.site-footer {
  margin-top: auto; background: var(--surface); border-top: 1px solid var(--line);
  font-size: .82rem; color: var(--muted);
}
.footer-bar { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
              min-height: 40px; padding: .35rem 0; }
.footer-bar a { color: var(--ink-soft); }
.footer-sep { color: var(--line-strong); }
.coffee {
  display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem;
  border-radius: 999px; background: #fff8e6; border: 1px solid #f4dfae; color: #92400e;
  font-weight: 600;
}
.coffee:hover { background: #fdf0cf; text-decoration: none; }

/* -------------------------------------------------------------------- landing */
.hero { padding: 3rem 0 2rem; }
.hero h1 { font-size: 2.3rem; max-width: 24ch; }
.hero p.lead { font-size: 1.05rem; color: var(--ink-soft); max-width: 62ch; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
                gap: 1rem; margin: 2rem 0; }
.feature { background: var(--surface); border: 1px solid var(--line);
           border-radius: var(--radius-lg); padding: 1.1rem; }
.feature .icon { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-soft);
                 color: var(--brand-dark); display: grid; place-items: center;
                 font-weight: 700; margin-bottom: .5rem; }

.auth-wrap { padding: 2.5rem 0 3rem; }
.auth-card { padding: 1.6rem; }

/* -------------------------------------------------------------------- trang ủng hộ */
.support-hero { padding: 1.8rem 0 1.2rem; }
.support-hero h1 { margin-top: .5rem; }
.support-hero .lead { font-size: 1.02rem; }
.support-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
                gap: 1rem; }
.support-card .card-body { display: flex; flex-direction: column; gap: .9rem; }
.support-list { display: grid; grid-template-columns: auto 1fr; gap: .35rem .8rem;
                margin: 0; font-size: .9rem; }
.support-list dt { color: var(--muted); font-size: .82rem; }
.support-list dd { margin: 0; font-weight: 600; }
.support-list code { background: var(--surface-2); border: 1px solid var(--line);
                     border-radius: 6px; padding: .1rem .4rem; font-size: .92em; }
.support-placeholder { background: var(--warn-soft); border: 1px dashed #e8c98a;
                       border-radius: var(--radius); padding: .8rem; }
.support-placeholder pre { margin: .4rem 0 0; white-space: pre-wrap; }
.qr-frame { border: 1px dashed var(--line-strong); border-radius: var(--radius);
            background: var(--surface-2); min-height: 210px; display: grid;
            place-items: center; padding: .8rem; }
/* Khi da co anh QR that: bo khung dut net di. Khung do chi de ra hieu "cho dat anh";
   giu lai thi anh chup man hinh doc bi nhoi vao mot hop thap, day khoang trong hai ben.
   Anh tu no da la mot the co nen rieng, nen no lam khung cho chinh no. */
.qr-frame.has-qr { border: 0; background: none; padding: 0; min-height: 0; }
.qr-frame img { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; }
.qr-frame.has-qr img { width: 100%; max-width: 340px; height: auto; max-height: 440px;
                       object-fit: contain;
                       border-radius: 10px; box-shadow: 0 1px 4px rgb(15 23 42 / .12); }
.qr-empty { display: flex; flex-direction: column; align-items: center; gap: .25rem;
            color: var(--muted); text-align: center; }
.qr-icon { font-size: 2.4rem; line-height: 1; color: var(--line-strong); }
.stack-list { padding-left: 1.1rem; }
.stack-list li + li { margin-top: .35rem; }

@media print {
  .topbar, .site-footer, .editor-panel, .tabs { display: none !important; }
}

/* ------------------------------------------------- khoá / mở bộ chỉnh sửa */
.editor-panel.locked .editor-body input:disabled,
.editor-panel.locked .editor-body select:disabled,
.editor-panel.locked .editor-body textarea:disabled {
  background: var(--surface-2); color: var(--ink-soft); opacity: 1;
  border-color: var(--line); cursor: default;
}
.editor-panel.locked .drag-handle { opacity: .3; cursor: default; }
.lock-hint { font-size: .78rem; color: var(--muted); padding: .35rem .5rem; }

/* cột hành động trong bảng bước */
.col-id { width: 108px; }
.col-type { width: 232px; }
.col-actions { width: 132px; }
.cell-actions { display: flex; gap: .25rem; align-items: center; justify-content: flex-end; }
.cell-actions .btn { padding: .22rem .5rem; font-size: .78rem; }
.cell-actions .btn.has-items { border-color: #f0d9a8; background: var(--warn-soft);
                               color: #7c2d12; font-weight: 650; }
.derived { display: inline-block; padding: .25rem .5rem; border-radius: 6px;
           background: var(--warn-soft); border: 1px solid #f0d9a8; color: #7c2d12;
           font-weight: 650; font-size: .82rem; font-variant-numeric: tabular-nums; }
input.derived-input:disabled { background: var(--warn-soft); border-color: #f0d9a8;
                               color: #7c2d12; font-weight: 650; }

/* --------------------------------------------- hộp thoại chi tiết một bước */
dialog.modal-wide { width: min(900px, 96vw); }
.step-fields { display: flex; flex-wrap: wrap; gap: .7rem; }
.step-fields .field { flex: 0 0 150px; margin-bottom: 0; }
.step-fields .field.grow { flex: 1 1 220px; }
.decompose-toggle { display: flex; gap: .6rem; align-items: flex-start; margin: 1rem 0 .8rem;
                    padding: .75rem .9rem; border: 1px solid var(--line);
                    border-radius: var(--radius); background: var(--surface-2);
                    cursor: pointer; }
.decompose-toggle input { width: auto; margin-top: .25rem; flex: none; }
.decompose-toggle span { display: flex; flex-direction: column; gap: .15rem; }
#item-table tfoot th { background: var(--surface-2); font-size: .85rem;
                       font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------- hộp thoại phiên bản */
.version-current { padding: .55rem .8rem; border-radius: var(--radius);
                   background: var(--surface-2); border: 1px solid var(--line);
                   font-size: .88rem; margin-bottom: .9rem; }
.version-input { display: flex; align-items: center; gap: .3rem; }
.version-prefix { font-weight: 750; font-size: 1.15rem; color: var(--brand-dark); }
.version-dot { font-weight: 750; font-size: 1.15rem; color: var(--muted); }
input.version-part { width: 76px; text-align: center; font-size: 1.05rem; font-weight: 650;
                     font-variant-numeric: tabular-nums; }
