/* gateway_v2 — โทนเดียวกับหน้า Real-time Sessions ของตัวเดิม ปรับให้พอดีจอ Full HD */
:root {
  --bg: #f5f7fa;
  --card: #fff;
  --text: #1f2933;
  --muted: #6b7785;
  --border: #e3e8ee;
  --head: #f3f5f8;
  --primary: #0d6efd;
  --primary-soft: #e7f1ff;
  --ok: #0f9d78;
  --ok-soft: #e6f7f1;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
  --danger: #dc3545;
  --danger-soft: #fdecee;
  --radius: 8px;
  --shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }

/* แถบบน */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 22px;
  padding: 0 20px; height: 52px;
  background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); white-space: nowrap; text-decoration: none !important; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-mark { font-weight: 800; letter-spacing: .06em; color: var(--primary); }
.brand-rest { font-weight: 600; font-size: 13px; color: var(--muted); }
.topbar.impersonating { border-bottom-color: #f5c46b; }

/* แถบเตือนระหว่างเข้าใช้งานในนามผู้ใช้อื่น ติดอยู่ใต้แถบบนทุกหน้า */
.impersonation-bar {
  position: sticky; top: 52px; z-index: 19;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 20px; background: #fff4d6; color: #664d03;
  border-bottom: 1px solid #f5d88c; font-size: 13px;
}
.impersonation-bar .imp-meta { color: #8a6d1d; }
.impersonation-bar .btn { margin-left: auto; border-color: #d9a520; background: #fff; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  padding: 6px 12px; border-radius: 6px; color: var(--muted); font-weight: 600;
}
.topbar nav a:hover { background: var(--head); text-decoration: none; color: var(--text); }
.topbar nav a.active { background: var(--primary-soft); color: var(--primary); }
.user-chip { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.user-chip .who { text-align: right; line-height: 1.2; }
.user-chip .who small { color: var(--muted); display: block; font-size: 11.5px; }

/* โครงหน้า */
.page { padding: 18px 20px 40px; }
.page.narrow { max-width: 760px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .spacer { flex: 1; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px;
}
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* แถบตัวกรอง */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.toolbar label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13px; }
.toolbar .spacer { flex: 1; }

input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="datetime-local"], select, textarea {
  font: inherit; font-size: 13px; color: var(--text);
  border: 1px solid #ccd3da; border-radius: 5px; padding: 5px 8px; background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}
textarea { font-family: var(--mono); font-size: 12px; width: 100%; }

/* ปุ่ม */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap;
  padding: 5px 12px; border-radius: 5px; border: 1px solid #ccd3da;
  background: #fff; color: var(--text); cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--head); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #0b5ed7; }
.btn.send { background: #1abc9c; border-color: #1abc9c; color: #fff; }
.btn.send:hover { background: #16a085; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #c82333; }
.btn.ghost-danger { color: var(--danger); border-color: #f1b0b7; }
.btn.ghost-danger:hover { background: var(--danger-soft); }
.btn.small { padding: 3px 9px; font-size: 12px; }

/* ตาราง */
.table-wrap { overflow: auto; max-height: 72vh; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 6px 10px; border-bottom: 1px solid #eef1f4; white-space: nowrap; text-align: left; vertical-align: middle; }
.data-table thead th { position: sticky; top: 0; z-index: 2; background: var(--head); font-weight: 600; border-bottom: 2px solid #dde2e7; }
.data-table tbody tr:nth-child(even) { background: #fafbfc; }
.data-table tbody tr:hover { background: #f1f7ff; }
.data-table td.wrap { white-space: normal; }
.data-table td.num { font-variant-numeric: tabular-nums; }
.data-table .empty { text-align: center; color: var(--muted); padding: 24px; }
/* หน้า Live data: เฟรมยาวให้ตัดบรรทัดในช่องของตัวเอง ตารางจะได้ไม่กว้างเกินจอ */
.live-table td.frame { white-space: normal; word-break: break-all; font-family: var(--mono); font-size: 12px; min-width: 360px; }

/* ป้ายสถานะ */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 11.5px; font-weight: 600;
  background: #f1f3f5; color: #495057; white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--primary-soft); color: var(--primary); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.count-badge { background: var(--primary); color: #fff; padding: 2px 12px; border-radius: 12px; font-size: .95rem; font-weight: 700; }

/* ลิงก์ [loc] [data] แบบเดียวกับตัวเดิม */
.loc-link, .data-link {
  display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 0.75rem; font-weight: 600;
  text-decoration: none !important; margin-left: 4px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: background-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.loc-link:hover, .data-link:hover { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18); transform: translateY(-1px); }
.loc-link { background: #e7f3ff; color: #0d6efd; }
.data-link { background: #eafaf6; color: #0f9d78; }

/* แท็บ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs button {
  font: inherit; font-weight: 600; color: var(--muted); background: none; border: none;
  padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ฟอร์มใน dialog */
dialog {
  border: none; border-radius: 10px; padding: 0; width: min(560px, 94vw);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
dialog::backdrop { background: rgba(15, 23, 42, 0.35); }
dialog form { padding: 18px 20px; }
dialog h2 { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 12px; align-items: center; }
.form-grid > label { color: var(--muted); font-weight: 600; font-size: 13px; }
.form-grid input[type="text"], .form-grid input[type="password"], .form-grid input[type="number"], .form-grid select, .form-grid textarea { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checks label { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text); font-weight: 400; }
.hint { font-size: 12px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 13px; min-height: 1em; margin-top: 8px; }

/* กล่องข้อความแจ้ง */
.notice { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; border: 1px solid; }
.notice.info { background: var(--primary-soft); border-color: #b6d4fe; color: #084298; }
.notice.warn { background: var(--warn-soft); border-color: #f5d88c; color: #664d03; }

/* ข้อมูลอุปกรณ์ */
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.stream { max-height: 460px; overflow: auto; font-family: var(--mono); font-size: 12px; background: #0f172a; color: #d6deeb; border-radius: 6px; padding: 8px 10px; }
.stream div { white-space: pre-wrap; word-break: break-all; padding: 1px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.stream .t { color: #7fdbca; }
.stream .k { color: #f78c6c; }
pre.json { max-height: 460px; overflow: auto; background: #f7f9fb; border: 1px solid var(--border); border-radius: 6px; padding: 10px; font-size: 12px; margin: 0; }
pre.json.wrap { white-space: pre-wrap; word-break: break-all; }

/* Live data ในหน้าอุปกรณ์: stream | ข้อมูลที่ถอด | dbg (จอกลางวาง stream ไว้บน จอแคบเรียงลงมา) */
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 14px; align-items: start; }
.live-grid .stream { height: 700px; max-height: none; }
.stream:focus { outline: none; }
.stream:focus-visible { outline: 2px solid #58a6ff; outline-offset: 2px; }
.stream.clickable > div { cursor: pointer; }
.stream.clickable > div:hover { background: rgba(255, 255, 255, 0.06); }
.stream > div.sel { background: rgba(88, 166, 255, 0.22); box-shadow: inset 3px 0 0 #58a6ff; }
.decode { height: 700px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--card); transition: opacity .15s; }
.decode.loading { opacity: .55; }
.decode-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-height: 42px; padding: 7px 12px; background: var(--head); border-bottom: 1px solid var(--border); font-size: 13px;
}
.decode-head .spacer { flex: 1; }
.dec-type { font-weight: 700; }
.decode-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.decode-main, .decode-dbg { padding: 10px 12px 14px; min-width: 0; }
.decode-dbg { border-left: 1px solid var(--border); }
.decode h3 { font-size: 13px; margin: 0 0 8px; }
.decode h4 { font-size: 12px; margin: 0 0 6px; color: var(--muted); }
.dec-title { margin: 0 0 8px; font-weight: 600; font-size: 13px; }
.dec-kv { grid-template-columns: 112px minmax(0, 1fr); gap: 5px 10px; }
.dec-section { margin-top: 12px; }
.dec-params { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); gap: 3px 10px; margin: 0; font-size: 12px; }
.dec-params dt { color: var(--muted); }
.dec-params dd { margin: 0; overflow-wrap: anywhere; }
.dec-raw { margin-top: 12px; }
.dec-raw summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.dec-raw pre { margin-top: 6px; max-height: 280px; }
.dbg-raw { color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; margin: -2px 0 10px; }
.dbg-note { margin: 0 0 10px; padding: 7px 10px; font-size: 12px; }
.dbg-flags-raw { display: inline-block; padding: 2px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--head); letter-spacing: .35em; font-size: 13px; }
.dbg-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.dbg-flag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border: 1px solid; border-radius: 12px; font-size: 12px; }
.dbg-flag.good { background: var(--ok-soft); color: var(--ok); border-color: #b5e3d3; }
.dbg-flag.bad { background: var(--danger-soft); color: var(--danger); border-color: #f5c2c7; font-weight: 600; }
.dbg-flag.unknown { background: var(--head); color: var(--muted); border-color: var(--border); }
.dbg-counters { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 5px; }
.dbg-counter { border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; }
.dbg-counter-top { display: flex; justify-content: space-between; gap: 6px; }
.dbg-counter small { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }
.dbg-counter:not(.hot) { color: var(--muted); }
.dbg-counter.hot { border-color: #f5d88c; background: var(--warn-soft); }
.dbg-counter.hot b { color: var(--warn); }
@media (max-width: 1500px) {
  .live-grid { grid-template-columns: minmax(0, 1fr); }
  .live-grid .stream { height: 300px; }
  .decode { height: 640px; }
}
@media (max-width: 900px) {
  .decode { height: auto; }
  .decode-cols { grid-template-columns: minmax(0, 1fr); }
  .decode-dbg { border-left: 0; border-top: 1px solid var(--border); }
  .dec-params { grid-template-columns: max-content minmax(0, 1fr); }
}

/* หน้า login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; }
.login-card h1 { margin-bottom: 4px; }
.login-brand { margin-bottom: 10px; text-align: center; }
.login-logo { width: 240px; max-width: 100%; height: auto; display: block; margin: 6px auto 8px; }
.login-brand .brand-rest { font-size: 14px; }
.login-card > .muted { text-align: center; }
.login-card form { display: grid; gap: 10px; margin-top: 16px; }
.login-card input { width: 100%; padding: 8px 10px; font-size: 14px; }
.login-card .btn { padding: 8px 12px; font-size: 14px; }

.error-card { text-align: center; margin-top: 60px; }
.error-card h1 { font-size: 3rem; color: var(--muted); }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 100; max-width: 420px;
  background: #1f2933; color: #fff; padding: 10px 16px; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); font-size: 13px;
}
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* หน้า System */
.sys-note { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; padding: 10px 16px; }
.sys-h { font-size: 15px; margin: 18px 0 8px; color: var(--text); }
.sys-foot { margin-top: 8px; font-size: 12.5px; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.sys-grid .card.meter { margin-bottom: 0; }
.meter { --lv: var(--ok); border-top: 3px solid var(--lv); }
.meter[data-level="warn"] { --lv: #e0a100; }
.meter[data-level="bad"] { --lv: var(--danger); }
.meter-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.meter-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.meter-bar { height: 6px; border-radius: 3px; background: #e9edf2; overflow: hidden; margin: 4px 0 4px; }
.meter-fill { height: 100%; width: 0; background: var(--lv); transition: width .4s ease; }
.meter-sub { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.meter-spark { margin-top: 6px; }
.meter-hint { font-size: 11.5px; margin-top: 4px; line-height: 1.35; }
.spark { width: 100%; height: 34px; display: block; }
.spark-line { fill: none; stroke: var(--primary); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.meter[data-level="warn"] .spark-line { stroke: #e0a100; }
.meter[data-level="bad"] .spark-line { stroke: var(--danger); }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
table.mini td { padding: 2px 0; border-bottom: 1px solid var(--border); }
table.mini td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sys-table th.num, .sys-table td.num { text-align: right; }
.sys-h2 { font-size: 13.5px; margin: 16px 0 6px; color: var(--muted); }
.fr-grid { margin: 12px 0 4px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.fr-grid .card { margin-bottom: 0; }
.fr-bar { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 2px 0; }
.fr-bar .lbl { width: 64px; color: var(--muted); }
.fr-bar .bar { flex: 1; height: 8px; background: #e9edf2; border-radius: 4px; overflow: hidden; }
.fr-bar .bar i { display: block; height: 100%; background: var(--primary); }
.fr-bar .n { width: 70px; text-align: right; font-variant-numeric: tabular-nums; }
.fr-frame { font-family: var(--mono); font-size: 11.5px; white-space: normal; word-break: break-all; min-width: 320px; }
.sys-table td.warn-cell { color: var(--warn); font-weight: 600; }
.oasis { margin: 8px 0; }
table.oasis-table { max-width: 520px; }
table.oasis-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 2px 8px 2px 0; }
table.oasis-table td.num { text-align: right; }
.dec-sub { margin: 8px 0 4px; font-size: 13px; font-weight: 600; }
table.oasis-table thead th:not(:first-child) { text-align: right; }

/* Playback (หน้า Devices) */
.pb-section { margin-top: 24px; }
.pb-choices { display: flex; flex-direction: column; gap: 6px; }
.pb-choices label { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 400; font-size: 13px; }
.pb-choices label:has(input:disabled) { color: var(--muted); }
.pb-range { display: flex; flex-direction: column; gap: 6px; }
.pb-presets { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pb-dates { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 6px 8px; }
.pb-dates span { color: var(--muted); font-size: 12.5px; }
.pb-dates input { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; max-width: 240px; }
.pb-estimate { margin-top: 12px; padding: 9px 12px; border-radius: var(--radius); background: var(--head); font-size: 13px; min-height: 38px; }
.pb-estimate.ok { background: var(--ok-soft); color: #0b6b53; }
.pb-estimate.bad { background: var(--danger-soft); color: var(--danger); }
.pb-progress { display: flex; flex-direction: column; gap: 3px; min-width: 190px; }
.pb-progress progress { width: 100%; height: 8px; accent-color: var(--primary); }
.pb-progress small { color: var(--muted); font-variant-numeric: tabular-nums; }
.pb-err { color: var(--danger); font-size: 12px; max-width: 280px; overflow-wrap: anywhere; }
.pb-actions { display: flex; gap: 6px; white-space: nowrap; }
@media (max-width: 640px) { #dlg-playback .form-grid { grid-template-columns: 1fr; } }

/* คิวคำสั่งในหน้าอุปกรณ์: ให้ข้อความขึ้นบรรทัดใหม่ ไม่ต้องเลื่อนแนวนอนจนปุ่มโดนตัด */
.data-table.cq td { white-space: normal; overflow-wrap: anywhere; padding: 6px 8px; } .data-table.cq td:last-child { white-space: nowrap; }

/* ---------- หน้า Flow: พอร์ต -> stream -> tenant (เรียบ สะอาด ใช้โทนเดียวกับหน้าอื่น) ---------- */
.flow-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.sbar { background: var(--card); border: 1px solid #dbe3ee; border-radius: 12px; padding: 10px 14px 9px; box-shadow: 0 1px 2px rgba(16, 38, 76, 0.06), 0 4px 12px rgba(16, 38, 76, 0.05); }
.sbar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sbar-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.sbar-val { font-family: var(--mono); font-weight: 700; font-size: 15px; white-space: nowrap; }
.sbar-track { height: 8px; border-radius: 6px; background: #e8eef6; margin: 7px 0 5px; overflow: hidden; }
.sbar-track i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #5aa2ff, #0d6efd); transition: width 0.6s; }
.sbar.warn .sbar-track i { background: linear-gradient(90deg, #f3c04a, #e0a800); }
.sbar.bad .sbar-track i { background: linear-gradient(90deg, #f58b96, #dc3545); }
.sbar-hint { font-size: 11.5px; color: var(--muted); min-height: 14px; }
.sbar.plain { display: flex; flex-direction: column; justify-content: center; }
.flow-board { position: relative; display: grid; grid-template-columns: minmax(200px, 300px) minmax(150px, 180px) minmax(180px, 280px) minmax(230px, 340px); justify-content: space-between; column-gap: 46px; align-items: center; padding: 18px 8px 8px; }
.flow-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }
.flow-lines path { fill: none; stroke-linecap: round; }
.flow-col { position: relative; display: flex; flex-direction: column; gap: 12px; z-index: 1; }
.flow-col h3 { margin: 0 0 2px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.fc { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px; box-shadow: var(--shadow); }
.fc.bad { border-color: #f1aeb5; background: #fffafb; }
.fc.off { opacity: 0.65; }
.fc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.fc-title { font-weight: 700; font-size: 15px; }
.fc-rate { white-space: nowrap; color: var(--muted); font-size: 12px; }
.fc-rate b { font-family: var(--mono); font-size: 17px; color: var(--text); margin-right: 3px; }
.fc-meta { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.fc-err { margin-top: 4px; font-size: 12.5px; color: var(--danger); }
.fc.fc-stream { text-align: center; padding: 44px 16px; min-height: 260px; display: flex; flex-direction: column; justify-content: center; gap: 4px; border-color: #b6d4fe; background: var(--primary-soft); }
.fc.fc-stream .big { font-family: var(--mono); font-size: 36px; font-weight: 700; margin: 6px 0 2px; }
.fc.fc-stream .fc-title { font-size: 17px; letter-spacing: 0.1em; }
.fc.fc-stream .fc-meta { font-size: 13px; }
.cons { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 5px; }
.cons li { display: flex; align-items: baseline; gap: 7px; font-size: 12.5px; }
.cons .name { font-weight: 600; font-family: var(--mono); }
.cons .info { color: var(--muted); }
.cons .none { color: var(--muted); font-style: italic; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c0c8d2; flex: none; transform: translateY(0px); }
.dot.connected { background: var(--ok); }
.dot.recent { background: #e0a800; }
.dot.idle { background: #c0c8d2; }
.fc.consumer .fc-title { font-family: var(--mono); font-size: 14px; }
.fc.consumer .tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.fc.consumer.idle { opacity: 0.8; }
.flow-empty { color: var(--muted); font-style: italic; font-size: 13px; padding: 10px 2px; }
/* แต่ละคอลัมน์เป็น block ของตัวเอง: พื้นไล่สี ขอบ เงาหลายชั้น ให้ดูมีมิติ การ์ดข้างในยกขึ้นอีกชั้น */
#col-ports, #col-tenants, #col-consumers {
  --acc: #0d6efd; --acc-soft: #e7f1ff;
  padding: 14px 14px 16px; border-radius: 18px; border: 1px solid #dbe3ee;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5fb 100%);
  box-shadow: 0 1px 2px rgba(16, 38, 76, 0.06), 0 10px 28px rgba(16, 38, 76, 0.09), inset 0 1px 0 #fff;
}
#col-tenants { --acc: #6f42c1; --acc-soft: #efe7fb; }
#col-consumers { --acc: #0f9d78; --acc-soft: #e1f6ef; background: linear-gradient(180deg, #ffffff 0%, #eef8f4 100%); }
#col-ports h3, #col-tenants h3, #col-consumers h3 {
  display: flex; align-items: center; gap: 8px; margin: 0 0 4px; padding-bottom: 10px; border-bottom: 1px solid #e3eaf3;
  color: var(--acc); font-size: 12.5px; letter-spacing: 0.08em;
}
#col-ports h3::before, #col-tenants h3::before, #col-consumers h3::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--acc); box-shadow: 0 0 0 4px var(--acc-soft); }
#col-ports .fc, #col-tenants .fc, #col-consumers .fc {
  border-color: #e3eaf3; border-left: 3px solid var(--acc); border-radius: 12px; padding: 10px 12px;
  background: linear-gradient(180deg, #fff, #fafcff);
  box-shadow: 0 1px 2px rgba(16, 38, 76, 0.07), 0 4px 10px rgba(16, 38, 76, 0.06);
  transition: transform 0.15s, box-shadow 0.15s;
}
#col-ports .fc:hover, #col-tenants .fc:hover, #col-consumers .fc:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(16, 38, 76, 0.08), 0 10px 20px rgba(16, 38, 76, 0.1); }
#col-ports .fc.bad { border-left-color: var(--danger); background: linear-gradient(180deg, #fff, #fff6f7); }
#col-tenants .fc-title { font-size: 14px; }
#col-ports .fc-title { font-size: 15.5px; }
#col-ports .fc-meta .mono { font-size: 11.5px; }
.fc.fc-stream { border-radius: 16px; border: 1px solid #b6d4fe; background: linear-gradient(160deg, #eaf3ff, #d5e7ff); box-shadow: 0 2px 4px rgba(13, 110, 253, 0.12), 0 14px 30px rgba(13, 110, 253, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.8); }
.flow-foot { font-size: 12.5px; margin-top: 12px; }
@media (max-width: 900px) {
  .flow-board { grid-template-columns: 1fr; row-gap: 22px; }
  .flow-lines { display: none; }
}
