@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #f3f6f5;
  --side: #0f2a24;
  --side-text: #d7ebe4;
  --card: #ffffff;
  --line: #d9e5e0;
  --text: #17302b;
  --muted: #5f746e;
  --primary: #0f8f6c;
  --primary-2: #0b6d53;
  --warn: #b7791f;
  --bad: #c53030;
  --ok: #276749;
  --radius: 14px;
  --font: "Vazirmatn", Tahoma, sans-serif;
  --shadow: 0 8px 24px rgba(15, 42, 36, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

button, input, select, textarea {
  font-family: var(--font);
  font-size: 0.95rem;
  color: inherit;
}

/* Shell: fixed sidebar (RTL) + sticky header/footer — Tailwind complements this */
.hub-shell {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

.side.hub-side {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: 16rem;
  background: var(--side);
  color: var(--side-text);
  padding: 0.85rem 0.75rem;
  overflow: auto;
  transition: width .2s ease, transform .25s ease;
  display: flex;
  flex-direction: column;
}
.hub-side-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.hub-shell.is-collapsed .side.hub-side {
  width: 4.5rem;
}
.hub-shell.is-collapsed .hub-side-brand-text,
.hub-shell.is-collapsed .hub-side-label,
.hub-shell.is-collapsed .menu-title {
  display: none;
}
.hub-shell.is-collapsed .menu-link {
  text-align: center;
  padding: 0.65rem 0.35rem;
}
.hub-shell.is-collapsed .hub-side-collapse {
  transform: rotate(180deg);
}

.logo, .hub-side-brand {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  padding: 0.35rem 0.4rem 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 0.65rem;
  position: relative;
}
.logo-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background: #19b983; color: #06281e; font-weight: 700;
  flex: none;
}
.logo strong, .hub-side-brand-text strong { display: block; color: #fff; }
.logo small, .hub-side-brand-text small { color: #9fbeb4; }
.hub-side-collapse {
  margin-right: auto;
  width: 28px; height: 28px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  cursor: pointer;
  line-height: 1;
}
.hub-shell.is-collapsed .hub-side-collapse {
  margin: 0 auto;
}

.menu { display: grid; gap: 0.2rem; }
.menu-title {
  margin: 0.9rem 0.5rem 0.35rem;
  font-size: 0.75rem;
  color: #8fb0a6;
  font-weight: 700;
}
.menu-link {
  border: 0;
  background: transparent;
  color: var(--side-text);
  text-align: right;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: block;
}
.menu-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.menu-link.active {
  background: #19b983;
  color: #06281e;
  font-weight: 700;
}
a.quick-btn { text-decoration: none; color: inherit; display: block; }
.alert.err { background:#ffe5e5; color:#c53030; padding:.8rem; border-radius:10px; margin-bottom:1rem; }
.alert.ok { background:#e6f7ef; color:#276749; padding:.8rem; border-radius:10px; margin-bottom:1rem; }

.content.hub-main {
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin-right: 16rem;
  transition: margin-right .2s ease;
  padding: 0;
}
.hub-shell.is-collapsed .content.hub-main {
  margin-right: 4.5rem;
}

.head.hub-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.75rem;
  padding: 0.65rem 1.1rem;
  margin: 0;
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.head h1 { margin: 0; font-size: 1.2rem; }
.head p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.85rem; }
.hub-header-title { min-width: 0; }
.hub-header-actions { margin-right: auto; }

.hub-page {
  flex: 1;
  padding: 1rem 1.2rem 1.5rem;
  min-width: 0;
}

.hub-footer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  backdrop-filter: blur(8px);
}

.burger, .hub-desktop-toggle {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  flex: none;
}
.burger { display: none; }
.hub-desktop-toggle { display: inline-grid; place-items: center; }

.hub-groups-field { margin-bottom: 0.75rem; }
.hub-groups-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.hub-groups-list {
  display: grid;
  gap: 0.35rem;
  max-height: 10rem;
  overflow: auto;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faf9;
}
.hub-check {
  display: flex !important;
  align-items: center;
  gap: 0.45rem;
  margin: 0 !important;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  cursor: pointer;
}
.hub-check:hover { background: #fff; }
.hub-check input { width: auto !important; margin: 0 !important; }

.page { display: none; }
.page.active { display: block; }

.box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.box h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }
.box h3 { margin: 0.8rem 0 0.4rem; font-size: 0.95rem; }
.help { color: var(--muted); line-height: 1.7; margin: 0 0 0.8rem; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 0.75rem; }

.kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow);
}
.kpi-card span { display: block; color: var(--muted); font-size: 0.85rem; }
.kpi-card strong { display: block; font-size: 1.5rem; margin: 0.3rem 0; }
.kpi-card em { color: var(--muted); font-style: normal; font-size: 0.82rem; }

.two {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 0.9rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: right;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th { color: var(--muted); font-size: 0.82rem; font-weight: 600; }

.ok, .warn, .bad {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.ok { background: #e6f7ef; color: var(--ok); }
.warn { background: #fff4db; color: var(--warn); }
.bad { background: #ffe5e5; color: var(--bad); }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  line-height: 1.3;
  text-decoration: none;
  color: var(--text);
  box-shadow: none;
}
.btn:hover { background: #f7faf9; color: var(--text); }
.btn.primary, .btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}
.btn.primary:hover, .btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn.sm, .btn-sm { padding: 0.35rem 0.6rem; font-size: 0.82rem; }
.btn.danger, .btn-danger { color: var(--bad); background: #fff; border-color: var(--line); }
.btn.danger:hover, .btn-danger:hover { background: #fff1f1; color: var(--bad); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  background: #fff;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: #7dceb4;
  box-shadow: 0 0 0 3px rgba(15, 143, 108, 0.12);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.7; }
label { display: grid; gap: 0.35rem; margin-bottom: 0.7rem; color: var(--muted); font-size: 0.88rem; }
.checkline {
  display: flex !important;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
}
.checkline input { width: auto; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.quick-btn {
  border: 1px solid var(--line);
  background: #f7faf9;
  border-radius: 10px;
  padding: 0.75rem;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
}
.quick-btn:hover { border-color: #9fd6c2; background: #eaf8f2; }

.list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.45rem; }
.list li {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbfa;
}

.row-item {
  width: 100%;
  text-align: right;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  display: grid;
  gap: 0.2rem;
}
.row-item span, .row-item em { color: var(--muted); font-style: normal; font-size: 0.84rem; }
.row-item.active, .row-item:hover { border-color: #9fd6c2; background: #eaf8f2; }

.chat { display: grid; gap: 0.6rem; margin: 0.8rem 0 1rem; }
.bubble {
  max-width: 85%;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  line-height: 1.7;
  border: 1px solid var(--line);
}
.bubble small { display: block; margin-top: 0.35rem; color: var(--muted); font-size: 0.75rem; }
.bubble.in { background: #f4f7f6; }
.bubble.out { justify-self: end; background: #e7f7f0; border-color: #bfe8d6; }

/* Send wizard */
.steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.step {
  text-align: center;
  padding: 0.65rem 0.4rem;
  border-radius: 10px;
  background: #f4f7f6;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.step.on {
  background: #e7f7f0;
  border-color: #9fd6c2;
  color: var(--primary-2);
}

.send-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 1rem;
  align-items: start;
}
.panel { display: none; }
.panel.on { display: block; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.choice {
  display: grid !important;
  gap: 0.25rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  color: var(--text);
}
.choice span { color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.choice.wide { grid-column: 1 / -1; }
.choice:has(input:checked) {
  border-color: var(--primary);
  background: #eaf8f2;
  box-shadow: inset 3px 0 0 var(--primary);
}
.choice input { width: auto; }

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.checks label {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.checks label:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.checks input { width: auto; }

.dest-list { display: grid; gap: 0.4rem; max-height: 220px; overflow: auto; }
.dest {
  text-align: right;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
}
.dest.on { border-color: var(--primary); background: #eaf8f2; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; min-height: 28px; }
.chip {
  background: #eaf8f2;
  border: 1px solid #9fd6c2;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
}

.editor-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
#quillEditor { min-height: 150px; }
.ql-toolbar.ql-snow { border: 0 !important; border-bottom: 1px solid var(--line) !important; font-family: var(--font) !important; }
.ql-container.ql-snow { border: 0 !important; font-family: var(--font) !important; }
.ql-editor {
  min-height: 140px;
  direction: rtl;
  text-align: right;
  font-family: var(--font) !important;
  font-size: 0.95rem;
  line-height: 1.8;
}
.editor-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
.counter { margin-right: auto; color: var(--muted); font-size: 0.85rem; }
.emoji-box, .sticker-box {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.35rem;
  margin-top: 0.55rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfa;
}
.emoji-box button, .sticker-box button {
  border: 1px solid transparent;
  background: #fff;
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
  font-size: 1.2rem;
}
.when { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.5rem; }

.nav-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}
.grow { flex: 1; }

.phone {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #102820;
  color: #e8f5f0;
  overflow: hidden;
  min-height: 520px;
  position: sticky;
  top: 1rem;
}
.phone-top {
  text-align: center;
  padding: 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: #9fbeb4;
  font-size: 0.85rem;
}
.phone-body { padding: 1rem; }
.phone-bubble {
  background: #1d4a3f;
  border-radius: 16px 16px 4px 16px;
  padding: 0.8rem;
  line-height: 1.75;
  white-space: pre-wrap;
}
.phone-story {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}
.story-img {
  height: 260px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #1aa87b, #1d4a3f);
  font-weight: 700;
}
.phone-story > div:last-child { padding: 0.75rem; }
.phone-file {
  margin-top: 0.6rem;
  padding: 0.65rem;
  border-radius: 10px;
  background: rgba(0,0,0,0.25);
}

.review {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfa;
  padding: 0.9rem;
  line-height: 1.9;
}

.form-4, .form-3 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}
.form-3 { grid-template-columns: repeat(3, 1fr); }

.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.8rem;
}
.toolbar h2 { margin: 0; margin-left: auto; }

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  margin-bottom: 0.55rem;
  display: grid;
  gap: 0.35rem;
  background: #f9fbfa;
}
.card span { color: var(--muted); font-size: 0.85rem; }

.attach {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfa;
}
.attach span { display: block; color: var(--muted); font-size: 0.82rem; }

.code {
  direction: ltr;
  text-align: left;
  background: #0f2a24;
  color: #d7ebe4;
  border-radius: 12px;
  padding: 1rem;
  overflow: auto;
  line-height: 1.55;
  font-size: 0.84rem;
}

.toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0f2a24;
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  z-index: 50;
  font-family: var(--font);
}
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 30;
}

/* Row actions + dynamic form rows (bots/channels/groups/customers/users lists) */
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.hub-hidden-form { display: none; }
.hub-hidden-detail { display: none; }
.hub-rows { display: grid; gap: .5rem; margin-bottom: .5rem; }
.hub-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; }
.hub-row--wide { grid-template-columns: 1fr 1fr 1fr auto; }
.hub-row input, .hub-row select { margin: 0; }

/* HubUI modal */
.hub-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 26, 22, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 200;
  opacity: 0;
  transition: opacity .18s ease;
}
.hub-modal-overlay.on { opacity: 1; }
.hub-modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(15, 42, 36, 0.28);
  width: min(560px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(.98);
  transition: transform .18s ease;
}
.hub-modal-overlay.on .hub-modal { transform: translateY(0) scale(1); }
.hub-modal--sm { width: min(400px, 100%); }
.hub-modal--md { width: min(560px, 100%); }
.hub-modal--lg { width: min(820px, 100%); }
.hub-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.1rem 0.7rem;
  border-bottom: 1px solid var(--line);
}
.hub-modal-title { margin: 0; font-size: 1.05rem; }
.hub-modal-close {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: .2rem .5rem;
  border-radius: 8px;
}
.hub-modal-close:hover { background: #f4f7f6; color: var(--text); }
.hub-modal-body {
  padding: 1.1rem;
  overflow: auto;
}
.hub-modal-body form.hub-hidden-form,
.hub-modal-body form { display: block; }
.hub-modal-body label { margin-bottom: .6rem; }
.hub-modal-footer {
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--line);
}
.hub-modal-actions { display: flex; gap: .5rem; justify-content: flex-end; }

/* HubUI toast */
.hub-toast-host {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: .5rem;
  z-index: 250;
  align-items: center;
}
.hub-toast {
  background: #0f2a24;
  color: #fff;
  padding: 0.65rem 1.1rem;
  border-radius: 12px;
  font-family: var(--font);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateY(10px);
  transition: all .2s ease;
  text-align: center;
}
.hub-toast.on { opacity: 1; transform: translateY(0); }
.hub-toast--ok { background: #0f8f6c; }
.hub-toast--bad { background: #c53030; }
.hub-toast--info { background: #0f2a24; }

@media (max-width: 1100px) {
  .kpi, .form-4, .form-3, .grid-3, .choices { grid-template-columns: 1fr 1fr; }
  .two, .send-grid, .inbox { grid-template-columns: 1fr; }
  .phone { position: static; }
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .side.hub-side {
    width: min(86vw, 280px);
    transform: translateX(105%);
  }
  .side.hub-side.open { transform: none; }
  .hub-shell.is-collapsed .side.hub-side {
    width: min(86vw, 280px);
  }
  .content.hub-main,
  .hub-shell.is-collapsed .content.hub-main {
    margin-right: 0;
  }
  .burger { display: inline-grid; place-items: center; }
  .hub-desktop-toggle,
  .hub-side-collapse { display: none; }
  .hub-shell.is-collapsed .hub-side-brand-text,
  .hub-shell.is-collapsed .hub-side-label,
  .hub-shell.is-collapsed .menu-title {
    display: initial;
  }
  .hub-shell.is-collapsed .hub-side-brand-text { display: block; }
  .hub-shell.is-collapsed .menu-link {
    text-align: right;
    padding: 0.65rem 0.8rem;
  }
  .kpi, .form-4, .form-3, .grid-3, .choices, .quick { grid-template-columns: 1fr; }
  .hub-row--wide { grid-template-columns: 1fr; }
}

/* ─── HubDataTable ─────────────────────────────────────────── */
.hub-dt {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.hub-dt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
}
.hub-dt-title h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.hub-dt-title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.hub-dt-meta {
  color: var(--muted);
  font-size: 0.8rem;
}
.hub-dt-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.hub-dt-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: min(100%, 200px);
}
.hub-dt-search .hub-dt-ico {
  position: absolute;
  right: 0.65rem;
  color: var(--muted);
  pointer-events: none;
}
.hub-dt-search input {
  padding: 0.5rem 2.1rem 0.5rem 0.75rem;
  margin: 0;
  border-radius: 10px;
  background: #f7faf9;
}
.hub-dt-pagesize {
  width: auto;
  min-width: 6.8rem;
  margin: 0;
  padding: 0.5rem 0.6rem;
  background: #f7faf9;
}
.hub-dt-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  border-radius: 10px;
}
.hub-dt-ico {
  display: inline-flex !important;
  width: 16px !important;
  height: 16px !important;
  align-items: center;
  justify-content: center;
  flex: none;
  overflow: hidden;
}
.hub-dt-ico svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  display: block;
}
.hub-dt-export { position: relative; }
.hub-dt-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 40, 30, 0.12);
  padding: 0.35rem;
  display: grid;
  gap: 0.15rem;
}
.hub-dt-menu[hidden] {
  display: none !important;
}
.hub-dt-colpanel[hidden] {
  display: none !important;
}
.hub-dt-menu-item {
  border: 0;
  background: transparent;
  text-align: right;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.hub-dt-menu-item:hover { background: #f3faf7; }
.hub-dt-colpanel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  padding: 0.75rem 0.9rem;
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 12px;
  align-items: center;
}
.hub-dt-colpanel > strong { width: 100%; font-size: 0.9rem; }
.hub-dt-colcheck {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  color: var(--text);
  font-size: 0.86rem;
}
.hub-dt-colcheck input { width: auto; }
.hub-dt-tablewrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}
.hub-dt-table { margin: 0; }
.hub-dt-table thead th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #f7faf9, #f1f6f4);
  z-index: 1;
  white-space: nowrap;
  font-size: 0.8rem;
}
.hub-dt-thbtn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0;
}
.hub-dt-sortable.is-asc .hub-dt-thbtn,
.hub-dt-sortable.is-desc .hub-dt-thbtn { color: var(--primary); }
.hub-dt-rownum {
  width: 3rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: center !important;
}
.hub-dt-actions-h { width: 1%; white-space: nowrap; }
.hub-dt-actions-inner { display: inline-flex; gap: 0.3rem; flex-wrap: nowrap; }
.hub-dt-action {
  width: 2rem;
  height: 2rem;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text);
  padding: 0;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.hub-dt-action:hover {
  background: #f3faf7;
  border-color: #b7e0c9;
  color: var(--primary);
}
.hub-dt-action.is-danger {
  color: var(--bad);
}
.hub-dt-action.is-danger:hover {
  background: #fff1f1;
  border-color: #f0b4b4;
}
.hub-dt-empty {
  text-align: center !important;
  color: var(--muted);
  padding: 2rem 1rem !important;
}
.hub-dt-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}
.hub-dt-pageinfo {
  color: var(--muted);
  font-size: 0.85rem;
}
.hub-dt-pager {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}
.hub-dt-page-label {
  font-size: 0.85rem;
  min-width: 6.5rem;
  text-align: center;
}
.hub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.55rem;
}
.hub-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
  font-size: 0.9rem;
}
.hub-tab:hover { background: #f3faf7; color: var(--text); }
.hub-tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}
.hub-side-user {
  padding: 0.55rem 0.75rem 0.85rem;
  margin: 0 0.25rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.hub-side-user strong { display: block; color: #fff; font-size: 0.95rem; }
.hub-side-user small { color: #9fbeb4; }
.hub-side-logout {
  margin-top: auto;
  padding: 0.75rem 0.5rem 0.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.hub-logout-link {
  color: #ffb4b4 !important;
}
.hub-shell.is-collapsed .hub-side-user small { display: none; }
.settings-page { max-width: 720px; }
.hub-dt-avatar--lg {
  width: 44px;
  height: 44px;
  margin: 0;
}
.hub-dt-avatar--ph {
  display: inline-grid;
  place-items: center;
  background: #d9e5e0;
  color: #0f2a24;
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
}
.hub-msg-cell { min-width: 11rem; line-height: 1.45; }
.hub-modal-meta {
  padding: 0.65rem 1.1rem;
  border-top: 1px solid var(--line);
  background: #f7faf9;
  font-size: 0.82rem;
  color: var(--muted);
}
.hub-audit-line { margin: 0.15rem 0; }
.hub-audit-line b { color: var(--text); font-weight: 600; }
.hub-live-clock {
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hub-dt-cell-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.hub-dt-cell-main strong {
  display: block;
}
@media (max-width: 720px) {
  .hub-dt-toolbar {
    flex-direction: column;
  }
  .hub-dt-tools {
    width: 100%;
  }
  .hub-dt-search {
    flex: 1;
    min-width: 0;
  }
}

/* ─── Header chrome ───────────────────────────────────────── */
.hub-header { flex-wrap: wrap; gap: 0.55rem 0.75rem; }
.hub-global-search {
  position: relative;
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 280px;
}
.hub-global-search input {
  margin: 0;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  background: #f7faf9;
}
.hub-search-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 60;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,40,30,.14);
  max-height: 320px;
  overflow: auto;
  padding: 0.35rem;
}
.hub-search-item {
  display: block;
  width: 100%;
  text-align: right;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-decoration: none;
}
.hub-search-item:hover { background: #f3faf7; }
.hub-search-item small { display: block; color: var(--muted); font-size: 0.75rem; }
.hub-live-clock {
  display: flex;
  flex-direction: row;
  align-items: center;
  line-height: 1.35;
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.hub-live-time { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.hub-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: auto;
}
.hub-icon-menu { position: relative; }
.hub-icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font: inherit;
  color: var(--text);
  padding: 0;
}
.hub-icon-btn:hover { background: #f7faf9; }
.hub-icon-btn--user {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}
.hub-icon-btn--danger:hover { background: #fff1f1; color: var(--bad); }
.hub-icon-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 70;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,40,30,.14);
  padding: 0.35rem;
  display: grid;
  gap: 0.1rem;
}
.hub-icon-dropdown[hidden] { display: none !important; }
.hub-icon-dropdown--wide { min-width: 240px; }
.hub-icon-dropdown a,
.hub-icon-dropdown button {
  display: block;
  width: 100%;
  text-align: right;
  border: 0;
  background: transparent;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-decoration: none;
}
.hub-icon-dropdown a:hover,
.hub-icon-dropdown button:hover { background: #f3faf7; }
.hub-notify-empty { padding: 0.8rem; color: var(--muted); font-size: 0.86rem; text-align: center; }
.hub-logout-form { margin: 0; }
.logo-mark--img { object-fit: cover; padding: 0; }
.hub-readonly {
  background: #eef3f1 !important;
  color: var(--muted);
  cursor: not-allowed;
}
.hub-bot-card {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #f7faf9;
  margin-bottom: 0.75rem;
}
.hub-bot-card h4 { margin: 0 0 0.5rem; font-size: 0.9rem; }
.hub-phone-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.45rem;
  align-items: center;
}
.hub-messenger-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem;
  margin-bottom: 0.55rem;
  background: #fff;
}

/* Themes */
html[data-theme="blue"] {
  --side: #12253d;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --bg: #f3f6fb;
}
html[data-theme="blue"] .menu-link.active,
html[data-theme="blue"] .logo-mark { background: #3b82f6; color: #fff; }
html[data-theme="teal"] {
  --side: #0b2e2c;
  --primary: #0d9488;
  --primary-2: #0f766e;
}
html[data-theme="rose"] {
  --side: #3a1524;
  --primary: #e11d48;
  --primary-2: #be123c;
  --bg: #faf5f7;
}
html[data-theme="rose"] .menu-link.active,
html[data-theme="rose"] .logo-mark { background: #fb7185; color: #3a1524; }
html[data-theme="dark"] {
  --bg: #121a18;
  --card: #1a2421;
  --text: #e7efeb;
  --muted: #9bb0a8;
  --line: #2a3934;
  --side: #0a1613;
  --primary: #19b983;
  --primary-2: #0f8f6c;
}
html[data-theme="dark"] .hub-header,
html[data-theme="dark"] .hub-footer,
html[data-theme="dark"] .box,
html[data-theme="dark"] .hub-dt-tablewrap,
html[data-theme="dark"] .hub-icon-btn,
html[data-theme="dark"] .hub-icon-dropdown,
html[data-theme="dark"] .hub-search-panel {
  background: #1a2421;
  color: var(--text);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #121a18;
  color: var(--text);
  border-color: var(--line);
}
body[data-density="compact"] .hub-page { padding: 0.7rem 0.85rem; }
body[data-density="compact"] .box { padding: 0.75rem; }
body[data-density="compact"] .menu-link { padding: 0.45rem 0.65rem; }

@media (max-width: 1100px) {
  .hub-live-clock { font-size: 0.75rem; max-width: 42vw; }
}
@media (max-width: 860px) {
  .hub-global-search { max-width: none; order: 5; flex: 1 1 100%; }
  .hub-header-title { flex: 1; }
}

