:root {
  --sidebar: #0b2b20;
  --sidebar-2: #123527;
  --bg: #f2f5f4;
  --card: #ffffff;
  --line: #e3e9e6;
  --text: #17251f;
  --muted: #68796f;
  --accent: #00a884;
  --accent-dark: #008f70;
  --accent-soft: #e6f6f1;
  --warn: #b7791f;
  --warn-soft: #fdf3e0;
  --danger: #d64545;
  --danger-soft: #fdecec;
  --in-bubble: #ffffff;
  --out-bubble: #d9fdd3;
  --chat-bg: #ece5dd;
  --shadow: 0 1px 3px rgba(23,37,31,.08), 0 4px 14px rgba(23,37,31,.05);
  font-size: 14.5px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins','Mukta',system-ui,sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
.hidden { display: none !important; }
h1 { font-size: 1rem; font-weight: 600; }
h2 { font-size: 1.12rem; font-weight: 600; }
h3 { font-size: .95rem; font-weight: 600; }
.muted { color: var(--muted); font-size: .82rem; }
.err { color: var(--danger); font-size: .82rem; margin-top: 6px; min-height: 1em; }
code { font-family: 'IBM Plex Mono', monospace; font-size: .82em; background: var(--accent-soft); color: var(--accent-dark); padding: 1px 6px; border-radius: 5px; }



/* ---------- buttons / inputs ---------- */
.btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 9px; padding: 8px 15px; font-family: inherit; font-size: .86rem; font-weight: 500; cursor: pointer; transition: all .15s; }
.btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: .78rem; border-radius: 7px; }
input, select, textarea { width: 100%; background: #fff; border: 1.5px solid var(--line); color: var(--text); border-radius: 9px; padding: 9px 12px; font-family: inherit; font-size: .88rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,168,132,.12); }
label.fld { display: block; color: var(--muted); font-size: .76rem; font-weight: 500; margin: 12px 0 5px; text-transform: uppercase; letter-spacing: .4px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: calc(100vh - 34px); }
.sidebar { width: 232px; flex-shrink: 0; background: var(--sidebar); color: #cfe4da; padding: 18px 12px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg,#00c896,#008f70); display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 1rem; }
.brand h1 { color: #fff; font-size: .95rem; }
.brand p { font-size: .68rem; color: #7fa896; letter-spacing: 1px; text-transform: uppercase; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-btn { display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: none; color: #a9c6b8; padding: 9px 12px; border-radius: 9px; font-family: inherit; font-size: .87rem; font-weight: 500; cursor: pointer; }
.nav-btn:hover { background: var(--sidebar-2); color: #fff; }
.nav-btn.active { background: var(--accent); color: #fff; }
.nav-sep { font-size: .66rem; color: #5d7a6c; letter-spacing: 1.2px; text-transform: uppercase; padding: 12px 12px 4px; }
.sidebar-foot { font-size: .8rem; color: #7fa896; padding: 8px; border-top: 1px solid #1c4433; }
.main { flex: 1; padding: 24px 28px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { flex: 1; }

/* ---------- cards & stats ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); }
.stat .num { font-family: 'IBM Plex Mono', monospace; font-size: 1.65rem; font-weight: 500; color: var(--text); }
.stat .lbl { color: var(--muted); font-size: .76rem; font-weight: 500; }
.stat .trend { font-size: .72rem; color: var(--accent-dark); font-weight: 600; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .7rem; font-weight: 600; letter-spacing: .2px; }
.badge.green { background: var(--accent-soft); color: var(--accent-dark); }
.badge.gray { background: #eef1f0; color: var(--muted); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.red { background: var(--danger-soft); color: var(--danger); }

/* ---------- table ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; background: #fafcfb; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f7faf9; }
tr.clickable { cursor: pointer; }
.flow-dots { font-family: 'IBM Plex Mono', monospace; font-size: .74rem; color: #b7c4bd; white-space: nowrap; }
.flow-dots b { color: var(--accent-dark); font-weight: 600; }

/* ---------- inbox ---------- */
.inbox { display: flex; height: calc(100vh - 160px); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
.inbox-list { width: 300px; flex-shrink: 0; border-right: 1px solid var(--line); overflow-y: auto; }
.inbox-search { padding: 10px; border-bottom: 1px solid var(--line); }
.inbox-item { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid #f0f4f2; cursor: pointer; }
.inbox-item:hover, .inbox-item.active { background: var(--accent-soft); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg,#00c896,#0b6e58); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: .9rem; flex-shrink: 0; }
.inbox-item .info { flex: 1; min-width: 0; }
.inbox-item .nm { font-weight: 600; font-size: .87rem; display: flex; justify-content: space-between; gap: 6px; }
.inbox-item .nm .t { font-size: .68rem; color: var(--muted); font-weight: 400; flex-shrink: 0; }
.inbox-item .pv { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; display: flex; justify-content: space-between; gap: 6px; }
.unread { background: var(--accent); color: #fff; border-radius: 20px; padding: 1px 7px; font-size: .68rem; font-weight: 700; flex-shrink: 0; }
.inbox-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); }
.chat-head { padding: 11px 16px; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 11px; }
.chat-head .info { flex: 1; }
.chat-head .nm { font-weight: 600; font-size: .92rem; }
.chat-head .sub { font-size: .74rem; color: var(--muted); }
.chat-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 68%; padding: 8px 12px; border-radius: 10px; font-size: .87rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.08); position: relative; }
.bubble.in { background: var(--in-bubble); align-self: flex-start; border-top-left-radius: 3px; }
.bubble.out { background: var(--out-bubble); align-self: flex-end; border-top-right-radius: 3px; }
.bubble .meta { display: block; color: #7a8a80; font-size: .66rem; margin-top: 3px; text-align: right; }
.bubble.tpl { border-left: 3px solid var(--accent); }
.bubble .att { display: flex; align-items: center; gap: 9px; background: rgba(0,0,0,.05); border-radius: 8px; padding: 9px 11px; margin-bottom: 4px; font-weight: 500; }
.chat-foot { background: var(--card); border-top: 1px solid var(--line); padding: 10px 14px; position: relative; }
.window-banner { background: var(--warn-soft); border: 1px solid #f0d9ae; color: var(--warn); border-radius: 9px; padding: 8px 12px; font-size: .78rem; margin-bottom: 9px; display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.chat-row { display: flex; gap: 9px; align-items: center; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: none; background: transparent; color: var(--muted); font-size: 1.25rem; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent-dark); }
.attach-menu { position: absolute; bottom: 62px; left: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px rgba(23,37,31,.18); padding: 6px; z-index: 30; min-width: 200px; }
.attach-menu button { display: flex; align-items: center; gap: 11px; width: 100%; background: none; border: none; padding: 10px 13px; border-radius: 9px; font-family: inherit; font-size: .87rem; color: var(--text); cursor: pointer; }
.attach-menu button:hover { background: var(--accent-soft); }
.attach-menu .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .95rem; color: #fff; flex-shrink: 0; }

/* ---------- flows ---------- */
.flow-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.flow-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: #fafcfb; flex-wrap: wrap; }
.flow-head .info { flex: 1; min-width: 200px; }
.flow-steps { padding: 8px 18px 14px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #e8eeeb; }
.step:last-child { border-bottom: none; }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; font-size: .74rem; font-weight: 700; flex-shrink: 0; }
.step .s-info { flex: 1; min-width: 0; }
.step .s-tpl { font-weight: 600; font-size: .86rem; }
.step .s-time { font-size: .76rem; color: var(--muted); }
.step .s-time b { color: var(--accent-dark); }
.step .s-cond { font-size: .7rem; color: var(--warn); font-weight: 600; }
.step .s-actions { display: flex; gap: 3px; flex-shrink: 0; }
.mini-btn { width: 27px; height: 27px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: .75rem; color: var(--muted); }
.mini-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.switch input { display: none; }
.switch .sl { position: absolute; inset: 0; background: #cdd7d2; border-radius: 20px; transition: .2s; }
.switch .sl:before { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; }
.switch input:checked + .sl { background: var(--accent); }
.switch input:checked + .sl:before { left: 21px; }

/* ---------- connections ---------- */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.conn-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.conn-card .top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.conn-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; color: #fff; flex-shrink: 0; }
.conn-row { display: flex; justify-content: space-between; font-size: .82rem; padding: 6px 0; border-bottom: 1px dashed #eef2f0; }
.conn-row:last-child { border-bottom: none; }
.conn-row .k { color: var(--muted); }
.conn-row .v { font-weight: 500; }
.pipeline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pipe-node { background: var(--accent-soft); color: var(--accent-dark); border-radius: 10px; padding: 9px 13px; font-size: .78rem; font-weight: 600; text-align: center; }
.pipe-arrow { color: var(--muted); font-size: .9rem; }

/* ---------- misc ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.progress-bar { background: #e8eeeb; border-radius: 20px; height: 7px; width: 110px; overflow: hidden; display: inline-block; vertical-align: middle; }
.progress-bar > div { background: var(--accent); height: 100%; transition: width .5s; }
.modal { position: fixed; inset: 0; background: rgba(15,27,22,.45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal-card { background: var(--card); border-radius: 16px; padding: 26px; width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin: 14px 0 18px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #17251f; color: #fff; padding: 11px 22px; border-radius: 30px; font-size: .85rem; z-index: 300; box-shadow: 0 8px 24px rgba(0,0,0,.3); }

@media (max-width: 820px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; gap: 8px; padding: 10px; }
  .sidebar nav { flex-direction: row; flex-wrap: nowrap; }
  .nav-btn { white-space: nowrap; padding: 8px 11px; font-size: .8rem; }
  .nav-sep, .sidebar-foot { display: none; }
  .brand p { display: none; }
  .main { padding: 14px; }
  .inbox { flex-direction: column; height: auto; }
  .inbox-list { width: 100%; max-height: 230px; }
  .inbox-chat { min-height: 440px; }
  .bubble { max-width: 85%; }
}
/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--sidebar); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px; padding: 34px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card .brand { margin-bottom: 24px; }
.login-card .brand h1, .login-card .brand p { color: var(--text); }
.login-card .brand p { color: var(--muted); }
/* ---------- media in chat ---------- */
.bubble .att img { max-width: 240px; border-radius: 8px; display: block; }
.bubble audio { max-width: 230px; }
.bubble video { max-width: 260px; border-radius: 8px; display: block; }
.att-file { display: flex; align-items: center; gap: 9px; background: rgba(0,0,0,.05); border-radius: 8px; padding: 9px 11px; margin-bottom: 4px; font-weight: 500; font-size: .82rem; }
.spin { display:inline-block; width:14px; height:14px; border:2px solid var(--line); border-top-color: var(--accent); border-radius:50%; animation: sp .7s linear infinite; vertical-align: middle; }
@keyframes sp { to { transform: rotate(360deg); } }
