/* ============================================================
   CTC Hub — Design System
   Ngôn ngữ thiết kế mô phỏng HubSpot Web App (tham chiếu Mobbin)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@400;500;600;700&family=Nunito+Sans:ital,wght@0,400;0,600;0,700;0,800;1,400&display=swap');

:root {
  /* Chrome */
  --chrome: #213343;            /* thanh trên + sidebar */
  --chrome-hover: #2d425a;
  --chrome-active: #33475b;
  --chrome-text: #cbd6e2;

  /* Brand */
  --orange: #ff5c35;            /* nút chính */
  --orange-dark: #e24b2d;
  --orange-pale: #ffebe6;
  --teal-link: #0091ae;         /* link, filter chip */
  --teal-dark: #007a8c;
  --teal-pale: #e5f5f8;
  --teal-border: #7fd1de;
  --green-header: #00bda5;      /* header panel preview */
  --gold: #f5c26b;

  /* Text */
  --ink: #33475b;               /* chữ chính */
  --ink-strong: #2d3e50;
  --muted: #7c98b6;
  --faint: #99acc2;

  /* Surface */
  --canvas: #f5f8fa;
  --card: #ffffff;
  --border: #cbd6e2;
  --border-light: #dfe3eb;
  --border-faint: #eaf0f6;
  --row-hover: #f5f8fa;
  --shadow-pop: 0 1px 24px rgba(45, 62, 80, .24);

  /* Status */
  --red: #f2545b;
  --blue-info: #e5f5f8;

  --font-head: 'Lexend Deca', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --topbar-h: 44px;
  --sidebar-w: 56px;
  --radius: 3px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-head { font-family: var(--font-head); color: var(--ink); }

a { color: var(--teal-link); text-decoration: none; }
a:hover { color: var(--teal-dark); text-decoration: underline; }

button { font-family: var(--font-body); cursor: pointer; }

svg { display: block; }

/* ============ ICON HELPERS ============ */
.ic { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 13px; height: 13px; }
.ic-lg { width: 20px; height: 20px; }

/* ============ TOP BAR ============ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  height: var(--topbar-h);
  background: var(--chrome);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px 0 8px;
}
.topbar-logo {
  width: 34px; height: 34px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.topbar-logo:hover { background: var(--chrome-hover); }
.topbar-search {
  position: relative; width: 300px; flex: none;
}
.topbar-search input {
  width: 100%; height: 30px;
  background: #2d425a; border: 1px solid #435e7c; border-radius: var(--radius);
  color: #eaf0f6; font-family: var(--font-body); font-size: 13px;
  padding: 0 64px 0 30px; outline: none;
}
.topbar-search input::placeholder { color: #a9bdd5; }
.topbar-search input:focus { background: #fff; color: var(--ink); border-color: #00a4bd; box-shadow: 0 0 4px 1px rgba(0,164,189,.3); }
.topbar-search .sicon { position: absolute; left: 9px; top: 7px; color: #a9bdd5; }
.topbar-search input:focus ~ .sicon { color: var(--muted); }
.topbar-search .kbd {
  position: absolute; right: 8px; top: 6px;
  color: #a9bdd5; font-size: 11px; letter-spacing: 1px;
  border: 1px solid #435e7c; border-radius: 3px; padding: 1px 5px;
}
.topbar-add {
  width: 26px; height: 26px; border-radius: 50%;
  background: transparent; border: 1px solid #56718f; color: #cbd6e2;
  font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.topbar-add:hover { background: var(--chrome-hover); }
.topbar-spacer { flex: 1; }
.topbar-upgrade {
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: none; color: #ffb800;
  font-size: 13px; font-weight: 600; padding: 5px 8px; border-radius: var(--radius);
}
.topbar-upgrade:hover { background: var(--chrome-hover); }
.topbar-iconbtn {
  position: relative;
  width: 32px; height: 32px; border-radius: var(--radius);
  background: transparent; border: none; color: var(--chrome-text);
  display: flex; align-items: center; justify-content: center;
}
.topbar-iconbtn:hover { background: var(--chrome-hover); color: #fff; }
.topbar-iconbtn .dot {
  position: absolute; top: 3px; right: 4px;
  min-width: 14px; height: 14px; padding: 0 3px;
  background: var(--red); border-radius: 8px;
  color: #fff; font-size: 9px; font-weight: 800; line-height: 14px; text-align: center;
}
.topbar-copilot {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  background: transparent; border: 1px solid #56718f; border-radius: var(--radius);
  color: #eaf0f6; font-size: 13px; font-weight: 600;
}
.topbar-copilot:hover { background: var(--chrome-hover); }
.topbar-account {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 8px;
  background: transparent; border: none; border-radius: var(--radius);
  color: #eaf0f6; font-size: 13px; font-weight: 600;
}
.topbar-account:hover { background: var(--chrome-hover); }
.topbar-account .caret { color: #a9bdd5; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: #fff; flex: none;
  font-family: var(--font-body); letter-spacing: .2px;
}
.avatar.lg { width: 34px; height: 34px; font-size: 13px; }
.avatar.sm { width: 20px; height: 20px; font-size: 8px; }
.av-coral { background: #e66e50; }
.av-teal { background: #00a4bd; }
.av-navy { background: #516f90; }
.av-purple { background: #7b68ee; }
.av-green { background: #00bda5; }
.av-gray  { background: #99acc2; }

/* ============ SIDEBAR ============ */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 80;
  width: var(--sidebar-w);
  background: var(--chrome);
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 0;
}
.snav {
  position: relative;
  width: 40px; height: 38px; border-radius: var(--radius);
  background: transparent; border: none; color: var(--chrome-text);
  display: flex; align-items: center; justify-content: center;
  margin: 1px 0;
}
.snav:hover { background: var(--chrome-hover); color: #fff; }
.snav.active { background: var(--chrome-active); color: #fff; }
.snav.active::before {
  content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 2px; background: var(--orange);
}
.snav .dot {
  position: absolute; top: 4px; right: 5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
}
.sidebar .sep { width: 28px; height: 1px; background: #3e5974; margin: 6px 0; }
.sidebar .push { flex: 1; }

/* tooltip */
.snav[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; left: 50px; top: 50%; transform: translateY(-50%);
  background: var(--ink-strong); color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: var(--radius); white-space: nowrap; z-index: 200;
  font-family: var(--font-body);
}

/* ============ FLYOUT MENU ============ */
.flyout {
  position: fixed; z-index: 120;
  left: var(--sidebar-w); top: 60px;
  min-width: 200px;
  background: #fff; border-radius: 0 4px 4px 0;
  box-shadow: var(--shadow-pop);
  padding: 10px 0 12px;
  display: none;
}
.flyout.open { display: block; }
.flyout h5 {
  font-family: var(--font-head); font-size: 14px; font-weight: 700; color: var(--ink);
  padding: 6px 18px 8px;
}
.flyout a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 18px; font-size: 13px; color: var(--ink); text-decoration: none;
}
.flyout a:hover { background: var(--teal-pale); text-decoration: none; }
.flyout a.current { background: var(--teal-pale); box-shadow: inset 3px 0 0 var(--teal-link); }
.flyout .sep { height: 1px; background: var(--border-faint); margin: 8px 0; }
.flyout .spark { color: var(--orange); }

/* ============ BANNER (trial-style) ============ */
.appbanner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 95;
  height: 36px; background: var(--teal-border);
  color: var(--ink-strong); font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 16px;
}
.appbanner .bbtn {
  background: #fff; border: 1px solid var(--ink-strong); border-radius: var(--radius);
  color: var(--ink-strong); font-size: 12px; font-weight: 700; padding: 3px 10px;
}
.appbanner .bbtn:hover { background: var(--canvas); }
.appbanner .bright { position: absolute; right: 14px; font-weight: 700; font-size: 13px; color: var(--ink-strong); cursor: pointer; background:none; border:none; }
body.has-banner .topbar { top: 36px; }
body.has-banner .sidebar { top: calc(var(--topbar-h) + 36px); }
body.has-banner .page { padding-top: calc(var(--topbar-h) + 36px); }

/* ============ PAGE LAYOUT ============ */
.page {
  padding-top: var(--topbar-h);
  padding-left: var(--sidebar-w);
  min-height: 100vh;
}
.page-inner { padding: 22px 28px 48px; max-width: 1600px; }

.page-head { display: flex; align-items: flex-start; gap: 12px; }
.page-title { font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.page-title .caret { color: var(--teal-link); cursor: pointer; }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }

/* Tabs (underline) */
.tabs { display: flex; gap: 28px; margin: 14px 0 0; border-bottom: 1px solid var(--border-light); }
.tabs a {
  position: relative; padding: 9px 2px 11px;
  font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none;
}
.tabs a:hover { color: var(--teal-link); text-decoration: none; }
.tabs a.active { color: var(--ink-strong); }
.tabs a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 3px; background: #33475b; border-radius: 2px 2px 0 0;
}
.tabs.compact { gap: 22px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: var(--radius); font-size: 13px; font-weight: 600;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); color:#fff; }
.btn-outline-orange { background: #fff; color: var(--orange); border-color: var(--orange); }
.btn-outline-orange:hover { background: var(--orange-pale); color: var(--orange); }
.btn-secondary { background: #eaf0f6; color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: #dfe8f1; }
.btn-dark { background: #33475b; color: #fff; border-color: #33475b; }
.btn-dark:hover { background: #213343; color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: #eaf0f6; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-disabled, .btn[disabled] { background: #eaf0f6; color: #b0c1d4; border-color: #eaf0f6; cursor: not-allowed; }

/* ============ VIEW TABS (folder style) ============ */
.viewtabs { display: flex; align-items: flex-end; gap: 2px; margin-top: 16px; }
.viewtab {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--ink);
  background: #e6edf5; border: 1px solid var(--border-light); border-bottom: none;
  border-radius: 6px 6px 0 0; text-decoration: none; max-width: 220px;
}
.viewtab:hover { background: #dde6f0; text-decoration: none; color: var(--ink); }
.viewtab.active { background: #fff; color: var(--ink-strong); position: relative; }
.viewtab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: #fff; }
.viewtab .x { color: var(--muted); font-size: 14px; line-height: 1; }
.viewtab .x:hover { color: var(--ink); }
.viewtabs .addview {
  padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--teal-link); text-decoration: none;
}
.viewtabs .allviews { margin-left: auto; font-size: 13px; font-weight: 600; }

/* ============ TOOLBAR / FILTERS ============ */
.board {
  background: #fff; border: 1px solid var(--border-light); border-radius: 0 6px 6px 6px;
  padding: 14px 18px 20px;
}
.filterbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fchip {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; border-radius: var(--radius);
  color: var(--teal-link); font-size: 13px; font-weight: 600; padding: 6px 8px;
}
.fchip:hover { background: var(--teal-pale); }
.fchip .caret { font-size: 10px; }
.fchip.applied { background: var(--teal-pale); color: var(--teal-dark); }
.fchip.adv { color: var(--ink); }
.fchip.adv:hover { background: #eaf0f6; }
.filterbar .vsep { width: 1px; height: 18px; background: var(--border-light); margin: 0 6px; }
.filterbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.searchrow { display: flex; align-items: center; margin: 12px 0 0; gap: 10px; }
.tsearch { position: relative; width: 230px; }
.tsearch input {
  width: 100%; height: 32px; padding: 0 30px 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13px; color: var(--ink); outline: none;
}
.tsearch input:focus { border-color: #00a4bd; box-shadow: 0 0 4px 1px rgba(0,164,189,.3); }
.tsearch input::placeholder { color: var(--faint); }
.tsearch .sicon { position: absolute; right: 9px; top: 8px; color: var(--muted); }
.searchrow .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.linklike { background: none; border: none; color: var(--teal-link); font-size: 13px; font-weight: 600; padding: 6px 8px; border-radius: var(--radius); display: inline-flex; align-items: center; gap: 6px; }
.linklike:hover { background: var(--teal-pale); }

/* view toggle (list/board) */
.vtoggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.vtoggle button { width: 34px; height: 32px; background: #fff; border: none; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.vtoggle button.on { background: #eaf0f6; color: var(--ink); }

/* ============ TABLE ============ */
.tablewrap { margin-top: 12px; border: 1px solid var(--border-light); border-radius: var(--radius); overflow-x: auto; background: #fff; }
table.hs { width: 100%; border-collapse: collapse; min-width: 900px; }
table.hs thead th {
  background: var(--canvas); text-align: left;
  font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  color: var(--ink); padding: 9px 14px; border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}
table.hs thead th .sort { color: var(--faint); font-size: 10px; margin-left: 4px; }
table.hs thead th .colmenu { color: var(--faint); margin-left: 6px; }
table.hs tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border-faint); font-size: 13px; color: var(--ink); white-space: nowrap; }
table.hs tbody tr:hover td { background: var(--row-hover); }
table.hs .cellname { display: flex; align-items: center; gap: 9px; }
table.hs .rec { color: var(--teal-link); font-weight: 700; }
table.hs .rec:hover { text-decoration: underline; cursor: pointer; }
table.hs .dim { color: var(--muted); }
table.hs .chk { width: 34px; }
input[type="checkbox"].cb {
  width: 15px; height: 15px; accent-color: var(--teal-link); cursor: pointer;
}
.status-done {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--faint);
  display: inline-flex; align-items: center; justify-content: center; background: #fff;
}
.previewbtn {
  visibility: hidden; margin-left: 8px;
  height: 22px; padding: 0 10px; font-size: 11px; font-weight: 700;
  background: #eaf0f6; border: 1px solid var(--border); border-radius: var(--radius); color: var(--ink);
}
tr:hover .previewbtn { visibility: visible; }

.tablefoot { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 0 4px; font-size: 13px; color: var(--ink); }
.tablefoot .pgbtn { background: none; border: none; color: var(--muted); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.tablefoot .pgbtn.on { color: var(--teal-link); }
.tablefoot .pgnum { min-width: 26px; height: 26px; border: 1px solid var(--teal-link); color: var(--teal-link); border-radius: var(--radius); font-weight: 700; background: #fff; }
.tablefoot .perpage { color: var(--teal-link); font-weight: 700; background: none; border: none; display: inline-flex; align-items: center; gap: 4px; }
.tabletotal { font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* ============ CARDS / KPI ============ */
.card {
  background: #fff; border: 1px solid var(--border-light); border-radius: 6px;
  padding: 18px 22px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; }
.card-head h3 { font-size: 16px; font-weight: 600; }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.chiprow { display: flex; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.chip {
  font-size: 10px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  color: var(--ink); background: #eaf0f6; border-radius: 3px; padding: 4px 8px;
}
.statrow { display: flex; flex-wrap: wrap; }
.stat { flex: 1 1 0; min-width: 150px; text-align: center; padding: 22px 10px 14px; }
.stat .lbl { font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--ink); display: inline-flex; align-items: center; gap: 4px; }
.stat .lbl .info { color: var(--muted); }
.stat .val { font-family: var(--font-head); font-size: 32px; font-weight: 500; color: var(--ink-strong); margin-top: 10px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat .delta-none { color: var(--muted); }

.info-i {
  display: inline-flex; width: 13px; height: 13px; border-radius: 50%;
  border: 1px solid var(--muted); color: var(--muted);
  font-size: 9px; font-weight: 800; align-items: center; justify-content: center;
  font-style: normal; vertical-align: 1px;
}

/* ============ WORKSPACE ============ */
.ws-head { display: flex; align-items: center; gap: 10px; }
.ws-head h1 { font-size: 22px; font-weight: 600; }
.ws-owner { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; color: var(--teal-link); cursor: pointer; }
.ws-help { margin-left: auto; }
.helpcirc {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--teal-link); color: var(--teal-link);
  background: #fff; font-weight: 800; font-size: 13px;
}

.ws-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; margin-top: 20px; align-items: start; }
.ws-two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1180px) { .ws-grid { grid-template-columns: 1fr; } .ws-two { grid-template-columns: 1fr; } }

.wcard { background: #fff; border: 1px solid var(--border-light); border-radius: 6px; padding: 18px 20px; }
.wcard-head { display: flex; align-items: center; gap: 8px; }
.wcard-head h3 { font-size: 15px; font-weight: 700; }
.wcard-head .right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.wcard .empty { text-align: center; padding: 22px 10px 10px; }
.wcard .empty p { font-size: 13px; color: var(--ink); margin-top: 14px; }
.wcard .empty a { font-weight: 700; font-size: 13px; }

.sectionrow { display: flex; align-items: center; gap: 8px; margin: 26px 0 12px; }
.sectionrow h3 { font-size: 15px; font-weight: 700; }
.sectionrow .right { margin-left: auto; }

.pilltabs { display: flex; gap: 12px; margin: 12px 0 16px; }
.pilltab {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  min-width: 170px; padding: 12px 16px;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; font-weight: 700; color: var(--ink); cursor: pointer;
}
.pilltab .n { font-weight: 600; color: var(--ink); }
.pilltab.on { border-color: #33475b; box-shadow: inset 0 0 0 1px #33475b; }

.action-list { display: flex; flex-direction: column; gap: 12px; }
.action-item {
  display: flex; gap: 14px; align-items: flex-start;
  background: #fff; border: 1px solid var(--border-light); border-radius: 6px;
  padding: 16px 18px;
}
.action-item .aicon {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--canvas); border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.action-item .amain { flex: 1; min-width: 0; }
.action-item .amain b { font-size: 13.5px; font-weight: 700; }
.action-item .amain b a { font-weight: 700; }
.action-item .amain p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.action-item .amain .alink { display: inline-block; margin-top: 7px; font-size: 13px; font-weight: 700; }
.action-item .aside {
  flex: none; width: 230px; border-left: 1px solid var(--border-faint);
  padding-left: 16px; font-size: 12px; color: var(--muted);
  display: flex; gap: 8px; align-items: flex-start;
}
.action-item .aside .dealname { font-weight: 700; font-size: 12.5px; }
.action-item .dots { background: none; border: none; color: var(--muted); font-weight: 800; font-size: 15px; margin-left: auto; }

/* Right rail */
.rail { background: #fff; border: 1px solid var(--border-light); border-radius: 6px; overflow: hidden; }
.rail-tabs { display: flex; gap: 24px; padding: 0 20px; border-bottom: 1px solid var(--border-light); }
.rail-tabs button {
  background: none; border: none; padding: 13px 2px;
  font-size: 13.5px; font-weight: 700; color: var(--ink); position: relative;
}
.rail-tabs button.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: #33475b; border-radius: 2px 2px 0 0; }
.rail-pane { padding: 22px 22px 26px; display: none; }
.rail-pane.on { display: block; }
.rail-pane h3 { font-size: 17px; font-weight: 700; margin-top: 18px; }
.rail-pane p { font-size: 13px; color: var(--ink); margin-top: 10px; line-height: 1.5; }
.rail-illus { margin: 6px auto 4px; display: block; }

/* Activity feed */
.feed-head { display: flex; align-items: center; }
.feed-head h4 { font-size: 14px; font-weight: 700; }
.feed-head .right { margin-left: auto; }
.feed-cta { border: 1px solid var(--border-light); border-radius: 6px; padding: 16px; margin-top: 12px; }
.feed-cta h5 { font-family: var(--font-head); font-size: 14.5px; font-weight: 700; }
.feed-cta p { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.mailbtns { display: flex; gap: 10px; margin-top: 12px; }
.mailbtn {
  flex: 1; height: 34px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-weight: 700; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
.mailbtn:hover { background: var(--canvas); }
.feed-cta .only { display: block; text-align: center; font-size: 12.5px; font-weight: 700; margin-top: 10px; }
.feed-slider { margin: 14px 6px 2px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--orange), #ffb199); position: relative; }
.feed-slider i { position: absolute; top: -5px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--orange); }
.feed-slider i.l { left: 0; } .feed-slider i.r { right: 0; }

.feed-sample { margin-top: 16px; }
.feed-sample .cap { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.fitem { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border-faint); }
.fitem:last-child { border-bottom: none; }
.fitem .ftxt { font-size: 12.5px; line-height: 1.5; min-width: 0; }
.fitem .ftxt .who { color: var(--teal-link); font-weight: 700; }
.fitem .ftime { font-size: 11px; color: var(--faint); margin-top: 3px; }
.fitem .sub { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; margin-top: 7px; }
.fbadge {
  margin-left: auto; flex: none;
  font-size: 10px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
  border: 1px solid var(--border); border-radius: 3px; padding: 2px 7px; color: var(--ink);
  background: var(--canvas);
}
.feed-view { display: block; text-align: center; font-weight: 700; font-size: 13px; margin-top: 12px; }

/* ============ LEFT PANEL (workspace leads/tasks, help desk) ============ */
.split { display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 0; margin-top: 18px; border: 1px solid var(--border-light); border-radius: 6px; background: #fff; overflow: hidden; min-height: 480px; }
.lpanel { border-right: 1px solid var(--border-light); padding: 16px 0; }
.lpanel h4 { font-size: 15px; font-weight: 700; padding: 0 16px 10px; display: flex; align-items: center; }
.lpanel h4 .right { margin-left: auto; color: var(--muted); }
.lp-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; font-size: 13px; color: var(--ink); text-decoration: none;
}
.lp-item .n { margin-left: auto; color: var(--muted); font-size: 12px; }
.lp-item:hover { background: var(--canvas); text-decoration: none; color: var(--ink); }
.lp-item.on { background: var(--teal-pale); color: var(--ink-strong); font-weight: 700; }
.lp-item.on .n { color: var(--teal-dark); font-weight: 700; }
.lp-link { display: inline-flex; gap: 6px; padding: 9px 16px; font-size: 13px; font-weight: 700; }
.lp-cap { padding: 10px 16px 4px; font-size: 13px; font-weight: 700; color: var(--ink); display: flex; align-items: center; }
.lp-cap .caret { margin-left: 6px; color: var(--teal-link); }
.rpanel { padding: 16px 20px 24px; min-width: 0; }

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state h4 { font-size: 15px; font-weight: 800; margin-top: 18px; }
.empty-state p { font-size: 13px; color: var(--muted); margin-top: 8px; max-width: 420px; margin-left: auto; margin-right: auto; line-height: 1.5; }
.empty-box { border: 1px solid var(--border-light); border-radius: 6px; background: #fff; }

/* ============ INFO BANNER (in-page) ============ */
.notebar {
  display: flex; align-items: center; gap: 8px;
  background: var(--blue-info); border: 1px solid var(--teal-border); border-radius: var(--radius);
  padding: 10px 14px; font-size: 13px; color: var(--ink); margin-top: 14px;
}
.notebar b { font-weight: 700; }
.notebar .x { margin-left: auto; background: none; border: none; color: var(--ink); font-size: 15px; font-weight: 700; }

/* ============ CHARTS ============ */
.chartgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.chartgrid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
@media (max-width: 1180px) { .chartgrid, .chartgrid3 { grid-template-columns: 1fr; } }
.chartcard { background: #fff; border: 1px solid var(--border-light); border-radius: 6px; padding: 16px 18px 12px; min-width: 0; }
.chartcard h4 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.chartcard .legend { display: flex; gap: 14px; margin-top: 10px; font-size: 11.5px; color: var(--ink); align-items: center; flex-wrap: wrap; }
.legend .key { display: inline-flex; align-items: center; gap: 5px; }
.legend .swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chartcard svg.chart { width: 100%; height: auto; margin-top: 8px; }
.chart-empty { text-align: center; padding: 36px 16px 30px; }
.chart-empty p { font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.axislbl { font-size: 10px; fill: var(--muted); font-family: var(--font-body); }

/* ============ PREVIEW PANEL (deal) ============ */
.ppanel-backdrop { position: fixed; inset: 0; background: rgba(45,62,80,.28); z-index: 130; display: none; }
.ppanel { position: fixed; top: 0; right: -500px; bottom: 0; width: 480px; max-width: 92vw; background: #fff; z-index: 140; box-shadow: -4px 0 24px rgba(45,62,80,.25); transition: right .25s ease; display: flex; flex-direction: column; }
.ppanel.open { right: 0; }
.ppanel-backdrop.open { display: block; }
.ppanel-head { background: var(--green-header); color: #fff; padding: 14px 18px; display: flex; align-items: center; }
.ppanel-head h3 { color: #fff; font-size: 16px; font-weight: 700; }
.ppanel-head .x { margin-left: auto; background: none; border: none; color: #fff; font-size: 18px; font-weight: 700; }
.ppanel-body { overflow-y: auto; padding: 16px 20px 30px; flex: 1; }
.psec { border-bottom: 1px solid var(--border-faint); padding: 14px 0 18px; }
.psec:last-child { border-bottom: none; }
.psec-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink); }
.psec-head .tog { color: var(--teal-link); }
.psec-head .right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.pfield { margin-top: 14px; }
.pfield .k { font-size: 12px; color: var(--muted); }
.pfield .v { font-size: 13px; color: var(--ink); margin-top: 3px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.prio-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); display: inline-block; }
.pempty { text-align: center; padding: 20px 10px; }
.pempty p { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.pchips { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.pchip { background: var(--teal-pale); border: 1px solid var(--teal-border); color: var(--teal-dark); font-size: 12px; font-weight: 700; border-radius: 3px; padding: 4px 9px; display: inline-flex; gap: 6px; align-items: center; }
.pchips .right { margin-left: auto; }

/* ============ DROPDOWN / POPOVER ============ */
.pop {
  position: fixed; z-index: 150; min-width: 220px;
  background: #fff; border-radius: 4px; box-shadow: var(--shadow-pop);
  padding: 8px 0; display: none;
}
.pop.open { display: block; }
.pop a, .pop button.item {
  display: flex; width: 100%; text-align: left; align-items: center; gap: 10px;
  padding: 8px 16px; font-size: 13px; color: var(--ink); text-decoration: none;
  background: none; border: none;
}
.pop a:hover, .pop button.item:hover { background: var(--teal-pale); text-decoration: none; }
.pop .sep { height: 1px; background: var(--border-faint); margin: 6px 0; }
.pop .cap { padding: 8px 16px 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.pop .acct { padding: 10px 16px; display: flex; gap: 10px; align-items: center; }
.pop .acct .nm { font-weight: 800; font-size: 13px; }
.pop .acct .em { font-size: 12px; color: var(--muted); }

/* Notification popover */
.pop.notif { width: 330px; }
.nitem { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-faint); }
.nitem:last-child { border-bottom: none; }
.nitem .nt { font-size: 12.5px; line-height: 1.45; }
.nitem .ntime { font-size: 11px; color: var(--faint); margin-top: 3px; }

/* ============ AUTH PAGES ============ */
body.auth { background: #fff; }
.auth-top { display: flex; justify-content: center; padding: 40px 0 8px; }
.auth-top.left { justify-content: flex-start; padding: 26px 0 0 34px; }
.auth-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.auth-logo:hover { text-decoration: none; }
.auth-logo b { font-family: var(--font-head); font-size: 26px; font-weight: 700; color: var(--ink-strong); letter-spacing: -.3px; }
.auth-logo b i { color: var(--orange); font-style: normal; }
.auth-sub { text-align: center; font-size: 13px; color: var(--ink); }
.auth-wrap { max-width: 860px; margin: 0 auto; padding: 0 24px 60px; }
.auth-note {
  border: 1px solid var(--teal-border); background: #fff; border-radius: var(--radius);
  padding: 14px 18px; font-size: 13px; margin: 26px 0 34px;
  box-shadow: 0 0 0 4px rgba(127,209,222,.12);
}
.auth-note b { display: block; font-weight: 800; margin-bottom: 4px; }
.auth-cols { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 40px; align-items: start; }
@media (max-width: 800px) { .auth-cols { grid-template-columns: 1fr; } .auth-cols .vline { display: none; } }
.auth-cols .vline { background: var(--border-light); height: 100%; min-height: 220px; }
.field { margin-top: 18px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink); display: block; }
.field input[type=text], .field input[type=password], .field input[type=email] {
  width: 100%; height: 40px; margin-top: 6px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px; color: var(--ink); outline: none; background: #f5f8fa;
}
.field input:focus { border-color: #00a4bd; background: #fff; box-shadow: 0 0 4px 1px rgba(0,164,189,.3); }
.field .above { font-size: 12px; font-weight: 700; margin-top: 3px; display: inline-block; }
.auth-welcome { display: flex; align-items: baseline; gap: 14px; }
.auth-welcome .who { font-size: 14px; }
.auth-welcome .who b { display: block; font-weight: 800; font-size: 15px; }
.remember { display: flex; gap: 8px; align-items: center; margin-top: 16px; font-size: 13px; }
.auth-btn {
  width: 160px; height: 40px; margin-top: 20px;
  background: #eaf0f6; color: #b0c1d4; border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 700; cursor: not-allowed; transition: all .15s;
}
.auth-btn.ready { background: var(--orange); color: #fff; cursor: pointer; }
.auth-btn.ready:hover { background: var(--orange-dark); }
.auth-btn.wide { width: 100%; }
.sso-btn {
  width: 100%; height: 40px; margin-top: 12px;
  background: #eaf0f6; border: 1px solid var(--border-light); border-radius: var(--radius);
  font-size: 13.5px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.sso-btn:hover { background: #dfe8f1; }
.auth-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 60px; }
.auth-foot a { font-size: 12px; }
.verify-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 60px; max-width: 980px; margin: 40px auto 0; padding: 0 34px; align-items: start; }
@media (max-width: 900px) { .verify-grid { grid-template-columns: 1fr; } }
.verify-grid h1 { font-size: 26px; font-weight: 700; line-height: 1.35; }
.verify-grid .desc { font-size: 13px; color: var(--ink); margin-top: 14px; line-height: 1.55; }
.verify-side { text-align: center; padding-top: 10px; }
.verify-side p { font-size: 13px; color: var(--ink); margin-top: 14px; }
.return { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin: 18px 0 0 34px; }

/* ============ REPORTS DASHBOARD ============ */
.dash-head { display: flex; align-items: center; gap: 10px; }
.dash-head .star { color: var(--gold); }
.dash-head h1 { font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.dash-sub { display: flex; align-items: center; gap: 2px; margin-top: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border-light); }
.dash-sub .right { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.floattools {
  position: fixed; right: 0; top: 45%; z-index: 60;
  background: #fff; border: 1px solid var(--border-light); border-right: none;
  border-radius: 6px 0 0 6px; box-shadow: 0 2px 10px rgba(45,62,80,.12);
  display: flex; flex-direction: column;
}
.floattools button { width: 34px; height: 34px; background: none; border: none; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.floattools button:hover { color: var(--ink); background: var(--canvas); }

/* ============ MISC ============ */
.pill-lock {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--ink);
  background: none; border: none; padding: 6px 8px; border-radius: var(--radius);
}
.pill-lock:hover { background: #eaf0f6; }
.scroll-x { overflow-x: auto; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; } .mt24 { margin-top: 24px; }
.hidden { display: none !important; }

/* ============================================================
   PRODUCTION LAYER — a11y, toast, dropdown, modal, search,
   copilot, bulk bar, sidebar toggle, responsive mobile/desktop
   ============================================================ */

/* ---------- Focus & a11y ---------- */
:focus-visible { outline: 2px solid #00a4bd; outline-offset: 1px; border-radius: 3px; }
.skip-link {
  position: fixed; top: -48px; left: 12px; z-index: 500;
  background: var(--ink-strong); color: #fff; font-weight: 700; font-size: 13px;
  padding: 10px 16px; border-radius: 0 0 4px 4px; transition: top .15s;
}
.skip-link:focus { top: 0; color: #fff; text-decoration: none; }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 16px; bottom: 16px; z-index: 400; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fff; border: 1px solid var(--border-light); border-left: 4px solid #00bda5;
  border-radius: 4px; box-shadow: var(--shadow-pop);
  padding: 12px 14px; font-size: 13px; color: var(--ink);
  animation: toast-in .22s ease;
}
.toast.info { border-left-color: var(--teal-border); }
.toast.warn { border-left-color: var(--gold); }
.toast .tclose { margin-left: auto; background: none; border: none; color: var(--muted); font-weight: 700; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Dropdown engine ---------- */
.dd {
  position: fixed; z-index: 300; min-width: 190px; max-width: 300px;
  background: #fff; border-radius: 4px; box-shadow: var(--shadow-pop);
  padding: 6px 0; max-height: 320px; overflow-y: auto;
}
.dd button.dd-item {
  display: flex; width: 100%; align-items: center; gap: 8px; text-align: left;
  padding: 8px 16px; font-size: 13px; color: var(--ink); background: none; border: none;
}
.dd button.dd-item:hover { background: var(--teal-pale); }
.dd button.dd-item.sel { font-weight: 700; color: var(--teal-dark); }
.dd .dd-sep { height: 1px; background: var(--border-faint); margin: 5px 0; }
.dd .dd-clear { color: var(--red); font-weight: 600; }

/* ---------- Create modal (slide panel) ---------- */
.cmodal-backdrop { position: fixed; inset: 0; background: rgba(45,62,80,.4); z-index: 340; display: none; }
.cmodal-backdrop.open { display: block; }
.cmodal {
  position: fixed; top: 0; right: -520px; bottom: 0; width: 500px; max-width: 100vw;
  background: #fff; z-index: 350; box-shadow: -4px 0 24px rgba(45,62,80,.3);
  transition: right .22s ease; display: flex; flex-direction: column;
}
.cmodal.open { right: 0; }
.cmodal-head { background: var(--chrome); color: #fff; padding: 15px 20px; display: flex; align-items: center; }
.cmodal-head h3 { color: #fff; font-size: 16px; font-weight: 700; }
.cmodal-head .x { margin-left: auto; background: none; border: none; color: #cbd6e2; font-size: 18px; font-weight: 700; }
.cmodal-head .x:hover { color: #fff; }
.cmodal-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.cmodal-body .field:first-child { margin-top: 0; }
.cmodal-foot { border-top: 1px solid var(--border-light); padding: 14px 24px; display: flex; gap: 10px; background: var(--canvas); }

/* ---------- Search overlay ---------- */
.sov { position: fixed; inset: 0; z-index: 360; background: rgba(33,51,67,.55); display: none; padding: 9vh 16px 0; }
.sov.open { display: block; }
.sov-box { max-width: 640px; margin: 0 auto; background: #fff; border-radius: 6px; box-shadow: var(--shadow-pop); overflow: hidden; }
.sov-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-light); }
.sov-input input { flex: 1; border: none; outline: none; font-family: var(--font-body); font-size: 16px; color: var(--ink); }
.sov-input .kbd { color: var(--faint); font-size: 11px; border: 1px solid var(--border-light); border-radius: 3px; padding: 2px 6px; }
.sov-results { max-height: 46vh; overflow-y: auto; padding: 8px 0; }
.sov-cap { padding: 8px 18px 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.sov-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 18px; font-size: 13.5px; color: var(--ink); background: none; border: none; text-decoration: none; }
.sov-item:hover, .sov-item.hot { background: var(--teal-pale); text-decoration: none; color: var(--ink); }
.sov-item .k { color: var(--muted); font-size: 11.5px; margin-left: auto; flex: none; }
.sov-empty { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- Copilot panel ---------- */
.copilot {
  position: fixed; top: 0; right: -420px; bottom: 0; width: 400px; max-width: 100vw;
  background: #fff; z-index: 330; box-shadow: -4px 0 24px rgba(45,62,80,.25);
  transition: right .22s ease; display: flex; flex-direction: column;
}
.copilot.open { right: 0; }
.copilot-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border-light); font-family: var(--font-head); font-weight: 700; font-size: 15px; }
.copilot-head .x { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 17px; font-weight: 700; }
.copilot-log { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.cp-msg { max-width: 88%; padding: 10px 13px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.cp-msg.bot { background: var(--canvas); border: 1px solid var(--border-faint); align-self: flex-start; }
.cp-msg.user { background: var(--teal-pale); align-self: flex-end; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-chip { background: #fff; border: 1px solid var(--teal-link); color: var(--teal-link); font-size: 12.5px; font-weight: 600; border-radius: 14px; padding: 6px 12px; }
.cp-chip:hover { background: var(--teal-pale); }
.copilot-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border-light); }
.copilot-input input { flex: 1; height: 36px; border: 1px solid var(--border); border-radius: 18px; padding: 0 14px; font-family: var(--font-body); font-size: 13px; outline: none; }
.copilot-input input:focus { border-color: #00a4bd; }
.copilot-input button { width: 36px; height: 36px; border-radius: 50%; background: var(--orange); color: #fff; border: none; font-weight: 800; }

/* ---------- Bulk action bar ---------- */
.bulkbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--chrome); color: #fff; border-radius: 4px;
  padding: 9px 16px; margin: 12px 0 -4px; font-size: 13px; font-weight: 600;
}
.bulkbar button { background: none; border: none; color: #7fd1de; font-size: 13px; font-weight: 700; }
.bulkbar button:hover { color: #fff; }
.bulkbar .danger { color: #ffb1b5; }
.bulkbar .off { margin-left: auto; color: #cbd6e2; }

/* ---------- Sidebar collapse (desktop) & hamburger (mobile) ---------- */
.navtoggle {
  display: none; width: 34px; height: 34px; border-radius: var(--radius);
  background: transparent; border: none; color: #cbd6e2;
  align-items: center; justify-content: center; flex: none;
}
.navtoggle:hover { background: var(--chrome-hover); color: #fff; }
body.nav-collapsed .sidebar { display: none; }
body.nav-collapsed .page { padding-left: 0; }
.nav-expand {
  display: none; position: fixed; left: 10px; bottom: 14px; z-index: 85;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--chrome); color: #cbd6e2; border: none; box-shadow: 0 2px 10px rgba(45,62,80,.35);
  align-items: center; justify-content: center;
}
body.nav-collapsed .nav-expand { display: flex; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 75; background: rgba(33,51,67,.45); display: none; }

/* ---------- Responsive: ≤1180 handled per-component above ---------- */

@media (max-width: 1024px) {
  .page-inner { padding: 18px 18px 40px; }
  .topbar-search { width: 220px; }
  .topbar-upgrade { display: none; }
  .action-item .aside { width: 200px; }
}

@media (max-width: 900px) {
  .topbar-iconbtn.opt { display: none; }
  .topbar-copilot span.lbl { display: none; }
  .topbar-account .nm, .topbar-account .caret { display: none; }
  .topbar-search { flex: 1; width: auto; min-width: 0; }
  .topbar-search .kbd { display: none; }
  .topbar-spacer { display: none; }
  .appbanner { display: none; }
  body.has-banner .topbar { top: 0; }
  body.has-banner .sidebar { top: var(--topbar-h); }
  body.has-banner .page { padding-top: var(--topbar-h); }
}

@media (max-width: 768px) {
  .navtoggle { display: flex; }
  .topbar-logo { display: none; }
  .topbar-add { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; z-index: 96; top: var(--topbar-h) !important; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; }
  .page { padding-left: 0; }
  body.nav-collapsed .sidebar { display: flex; }
  .nav-expand { display: none !important; }
  .snav[data-tip]:hover::after { display: none; }

  .page-inner { padding: 14px 12px 40px; }
  .page-head { flex-wrap: wrap; }
  .page-actions { margin-left: 0; width: 100%; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .page-title { font-size: 19px; }
  .tabs { gap: 18px; overflow-x: auto; scrollbar-width: thin; }
  .tabs a { white-space: nowrap; padding-bottom: 10px; }
  .ws-head { flex-wrap: wrap; }
  .ws-owner { font-size: 15px; }

  .viewtabs { overflow-x: auto; scrollbar-width: none; }
  .viewtab { white-space: nowrap; flex: none; padding: 8px 12px; }
  .board { padding: 12px 12px 16px; border-radius: 0 0 6px 6px; }
  .filterbar { gap: 2px; }
  .searchrow { flex-wrap: wrap; }
  .tsearch { width: 100%; }
  .searchrow .right { margin-left: 0; }

  .split, .hd-split { grid-template-columns: 1fr !important; }
  .split .lpanel {
    border-right: none; border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 2px;
    overflow-x: auto; scrollbar-width: none; padding: 10px 8px;
  }
  .split .lpanel h4 { padding: 0 8px; white-space: nowrap; }
  .split .lpanel .lp-item { flex: none; border-radius: 14px; padding: 6px 12px; }
  .split .lpanel .lp-link, .split .lpanel .lp-cap { flex: none; white-space: nowrap; padding: 6px 8px; }
  .rpanel { padding: 14px 12px 20px; }
  .hd-left { border-right: none; border-bottom: 1px solid var(--border-light); }
  .hd-left .away { margin-top: 8px; border-top: none; }
  .hd-main { padding: 0 12px 24px; }

  .stat { min-width: 42%; padding: 16px 6px 10px; }
  .stat .val { font-size: 26px; }
  .pilltabs { flex-wrap: wrap; }
  .pilltab { min-width: 0; flex: 1 1 45%; }
  .action-item { flex-wrap: wrap; }
  .action-item .aside { width: 100%; border-left: none; border-top: 1px solid var(--border-faint); padding: 10px 0 0; margin-top: 4px; }

  .ppanel { width: 100vw; max-width: 100vw; }
  .cmodal { width: 100vw; }
  .copilot { width: 100vw; }
  .flyout { max-height: 70vh; overflow-y: auto; }
  .floattools { display: none; }
  .dash-sub { flex-wrap: wrap; }
  .dash-sub .right { width: 100%; margin: 6px 0 0; }

  .verify-grid { padding: 0 20px; gap: 24px; margin-top: 24px; }
  .auth-top.left { padding-left: 20px; }
  .return { margin-left: 20px; }
  table.hs { min-width: 640px; }
}

@media (max-width: 560px) {
  .page-title { font-size: 18px; }
  .btn { height: 32px; padding: 0 11px; font-size: 12.5px; }
  .stat { min-width: 46%; }
  .stat .val { font-size: 23px; }
  .ws-two { gap: 12px; }
  .wcard { padding: 14px; }
  .card { padding: 14px; }
  .chartcard { padding: 12px; }
  .tablefoot { flex-wrap: wrap; gap: 8px; }
  .auth-wrap { padding: 0 16px 40px; }
  .verify-grid h1 { font-size: 21px; }
}

/* Touch: nút hover-only phải luôn hiện */
@media (hover: none) {
  .previewbtn { visibility: visible; }
  .snav[data-tip]:hover::after { display: none; }
}

/* ============ KANBAN (Deals board view) ============ */
.kanban {
  display: flex; gap: 12px; overflow-x: auto; scrollbar-width: thin;
  padding: 14px 2px 8px; align-items: flex-start;
}
.kcol {
  flex: 0 0 248px; background: var(--canvas);
  border: 1px solid var(--border-light); border-radius: 6px;
}
.kcol-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
  padding: 10px 12px; border-bottom: 1px solid var(--border-light);
  font-size: 11px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; color: var(--ink);
}
.kcol-head .sum { color: var(--muted); font-weight: 700; text-transform: none; font-size: 12px; white-space: nowrap; }
.kcol-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 130px; }
.kcol.dragover { background: var(--teal-pale); outline: 2px dashed var(--teal-link); outline-offset: -4px; }
.kcard {
  background: #fff; border: 1px solid var(--border); border-radius: 4px;
  padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(45,62,80,.08);
}
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .45; }
.kcard .kname { font-size: 13px; font-weight: 700; color: var(--teal-link); line-height: 1.35; }
.kcard .kmeta { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.kcard .kamount { font-weight: 800; color: var(--ink); }
.kcard .kmove {
  margin-left: auto; background: none; border: none; color: var(--muted);
  font-weight: 800; font-size: 13px; padding: 2px 4px; border-radius: 3px;
}
.kcard .kmove:hover { background: var(--canvas); color: var(--ink); }
.kempty { font-size: 12px; color: var(--faint); text-align: center; padding: 16px 4px; }
@media (max-width: 768px) { .kcol { flex-basis: 220px; } }

/* ============================================================
   GIAI ĐOẠN 3 — Settings shell, builder canvas, marketplace,
   inbox, form builder, social composer, toggle switch, status pill
   ============================================================ */

/* ---------- Toggle switch (workflows/sequences/chatflows on-off) ---------- */
.toggle { position: relative; display: inline-block; width: 34px; height: 19px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute; inset: 0; background: #cbd6e2; border-radius: 20px; cursor: pointer; transition: background .15s;
}
.toggle .track::before {
  content: ""; position: absolute; left: 2px; top: 2px; width: 15px; height: 15px;
  background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.toggle input:checked + .track { background: #00bda5; }
.toggle input:checked + .track::before { transform: translateX(15px); }
.toggle input:focus-visible + .track { outline: 2px solid #00a4bd; outline-offset: 2px; }

/* ---------- Status pill (generic) ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill-on   { background: #d5f2ed; color: #00806e; }
.pill-off  { background: #eaf0f6; color: #7c98b6; }
.pill-warn { background: #fdecc8; color: #92660a; }
.pill-bad  { background: #fde0e1; color: #c81f28; }
.pill-info { background: var(--teal-pale); color: var(--teal-dark); }

/* ---------- Card grid (generic: marketplace, products, knowledge, playbooks) ---------- */
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 16px; }
.igrid-card {
  background: #fff; border: 1px solid var(--border-light); border-radius: 6px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.igrid-card .ihead { display: flex; align-items: center; gap: 10px; }
.igrid-card .ilogo {
  width: 38px; height: 38px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #fff;
}
.igrid-card .ititle { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.igrid-card .icat { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.igrid-card .idesc { font-size: 12.5px; color: var(--ink); line-height: 1.5; flex: 1; }
.igrid-card .ifoot { display: flex; align-items: center; gap: 8px; }

/* ---------- Settings shell ---------- */
.settings-shell { display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 0; min-height: calc(100vh - 44px); background: #fff; }
body.has-banner .settings-shell { min-height: calc(100vh - 80px); }
.settings-nav { border-right: 1px solid var(--border-light); padding: 18px 0 30px; overflow-y: auto; }
.settings-nav .snback { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 0 18px 14px; color: var(--teal-link); }
.settings-nav h4 { font-size: 18px; font-weight: 700; padding: 0 18px 12px; font-family: var(--font-head); }
.settings-nav .scap { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 16px 18px 6px; }
.settings-nav a { display: block; padding: 7px 18px; font-size: 13px; color: var(--ink); text-decoration: none; }
.settings-nav a:hover { background: var(--canvas); text-decoration: none; }
.settings-nav a.on { background: var(--teal-pale); color: var(--ink-strong); font-weight: 700; box-shadow: inset 3px 0 0 var(--teal-link); }
.settings-body { padding: 26px 34px 50px; min-width: 0; max-width: 900px; }
.settings-body h2 { font-size: 20px; font-weight: 700; }
.settings-body .shint { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.spanel { background: #fff; border: 1px solid var(--border-light); border-radius: 6px; padding: 20px 22px; margin-top: 18px; }
.spanel h3 { font-size: 15px; font-weight: 700; }
.srow { display: flex; align-items: flex-start; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border-faint); }
.srow:last-child { border-bottom: none; }
.srow .stext { flex: 1; min-width: 0; }
.srow .stext b { font-size: 13.5px; font-weight: 700; display: block; }
.srow .stext p { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.srow .sctrl { flex: none; padding-top: 2px; }
.srow input[type=text], .srow input[type=email] {
  height: 36px; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13px; width: 240px; outline: none;
}
.srow input:focus { border-color: #00a4bd; box-shadow: 0 0 4px 1px rgba(0,164,189,.3); }
.savebar { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.savebar .saved { font-size: 12.5px; color: #00806e; font-weight: 700; display: none; align-items: center; gap: 5px; }
.savebar .saved.show { display: inline-flex; }

/* ---------- Builder mode: ẩn chrome chuẩn, dùng .builder-top riêng ---------- */
body.builder-mode .topbar, body.builder-mode .sidebar, body.builder-mode .appbanner,
body.builder-mode .nav-expand, body.builder-mode .sidebar-backdrop, body.builder-mode .skip-link { display: none !important; }

/* ---------- Builder top bar (Workflow / Form / Social) ---------- */
.builder-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90; height: 48px;
  background: var(--chrome); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 18px;
}
.builder-top .bb-exit { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #cbd6e2; background: none; border: none; }
.builder-top .bb-exit:hover { color: #fff; }
.builder-top .bb-title { margin: 0 auto; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.builder-top .bb-status { font-size: 12px; color: #7fd1de; display: flex; align-items: center; gap: 5px; }
.builder-top .bb-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.builder-body { padding-top: 48px; min-height: 100vh; background: var(--canvas); }

/* ---------- Workflow canvas ---------- */
.wf-canvas {
  min-height: calc(100vh - 48px);
  background-image: radial-gradient(circle, #dfe6ee 1.2px, transparent 1.2px);
  background-size: 18px 18px;
  display: flex; flex-direction: column; align-items: center; padding: 60px 20px 100px;
}
.wf-node {
  background: #fff; border: 1.5px solid var(--border); border-radius: 6px;
  padding: 12px 16px; width: 270px; box-shadow: 0 1px 3px rgba(45,62,80,.1); position: relative;
}
.wf-node.trigger { border-color: #cbd6e2; }
.wf-node.action { border-color: #b3d9e2; }
.wf-node .wf-kicker { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.wf-node .wf-title { font-size: 13.5px; font-weight: 700; color: var(--ink); margin-top: 4px; }
.wf-node .wf-sub { font-size: 12px; color: var(--teal-link); margin-top: 4px; }
.wf-node .wf-del {
  position: absolute; top: 8px; right: 8px; background: none; border: none; color: var(--muted); font-size: 13px;
}
.wf-node .wf-del:hover { color: var(--red); }
.wf-connector { width: 2px; height: 28px; background: #b3d9e2; }
.wf-plus {
  width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--teal-link);
  color: var(--teal-link); font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center;
  margin: -1px 0; z-index: 1;
}
.wf-plus:hover { background: var(--teal-link); color: #fff; }

/* ---------- Form builder (2 columns: field list + preview) ---------- */
.fb-shell { display: grid; grid-template-columns: 300px minmax(0,1fr); min-height: calc(100vh - 48px); }
.fb-fields { border-right: 1px solid var(--border-light); background: #fff; padding: 18px; overflow-y: auto; }
.fb-fields h4 { font-size: 14px; font-weight: 700; }
.fb-field {
  display: flex; align-items: center; gap: 8px; background: var(--canvas); border: 1px solid var(--border-light);
  border-radius: 4px; padding: 9px 10px; margin-top: 8px; font-size: 12.5px; color: var(--ink);
}
.fb-field .fb-del { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 13px; }
.fb-field .fb-del:hover { color: var(--red); }
.fb-addfield { width: 100%; margin-top: 12px; }
.fb-preview { padding: 40px 20px; display: flex; justify-content: center; align-items: flex-start; }
.fb-card {
  width: 100%; max-width: 460px; background: #fff; border-radius: 8px; box-shadow: 0 1px 12px rgba(45,62,80,.12);
  padding: 26px 24px;
}
.fb-card p.fb-lead { font-size: 13.5px; color: var(--ink); margin-bottom: 16px; line-height: 1.5; }
.fb-card label { font-size: 12.5px; font-weight: 700; display: block; margin-top: 12px; }
.fb-card input, .fb-card select {
  width: 100%; height: 36px; margin-top: 5px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: 4px; font-family: var(--font-body); font-size: 13px;
}
.fb-card .fb-submit { margin-top: 18px; width: 100%; }

/* ---------- Social composer + calendar ---------- */
.soc-shell { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 20px; margin-top: 16px; align-items: start; }
@media (max-width: 1080px) { .soc-shell { grid-template-columns: 1fr; } }
.soc-compose { background: #fff; border: 1px solid var(--border-light); border-radius: 6px; padding: 18px 20px; }
.soc-compose textarea {
  width: 100%; min-height: 110px; border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px;
  font-family: var(--font-body); font-size: 13.5px; color: var(--ink); resize: vertical; outline: none;
}
.soc-compose textarea:focus { border-color: #00a4bd; box-shadow: 0 0 4px 1px rgba(0,164,189,.3); }
.soc-netpick { display: flex; gap: 8px; margin-bottom: 10px; }
.soc-netpick button {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 16px;
  border: 1.5px solid var(--border); background: #fff; font-size: 12.5px; font-weight: 700; color: var(--ink);
}
.soc-netpick button.on { border-color: var(--teal-link); background: var(--teal-pale); color: var(--teal-dark); }
.soc-count { font-size: 11.5px; color: var(--muted); text-align: right; margin-top: 6px; }
.soc-preview {
  border: 1px solid var(--border-light); border-radius: 8px; padding: 14px 16px; margin-top: 14px; background: var(--canvas);
}
.soc-preview .sp-head { display: flex; align-items: center; gap: 8px; }
.soc-preview .sp-name { font-size: 13px; font-weight: 700; }
.soc-preview .sp-text { font-size: 13px; margin-top: 8px; white-space: pre-wrap; line-height: 1.5; }
.soc-calendar { background: #fff; border: 1px solid var(--border-light); border-radius: 6px; padding: 16px 18px; }
.soc-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-faint); }
.soc-item:last-child { border-bottom: none; }
.soc-item .si-net {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 800;
}
.soc-item .si-text { font-size: 12.5px; color: var(--ink); line-height: 1.4; }
.soc-item .si-time { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- Inbox 3-pane ---------- */
.inbox-shell { display: grid; grid-template-columns: 220px 300px minmax(0,1fr); min-height: calc(100vh - 44px); background: #fff; }
body.has-banner .inbox-shell { min-height: calc(100vh - 80px); }
.inbox-nav { border-right: 1px solid var(--border-light); padding: 14px 0; }
.inbox-threads { border-right: 1px solid var(--border-light); overflow-y: auto; }
.ithread { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border-faint); text-decoration: none; color: var(--ink); }
.ithread:hover { background: var(--canvas); text-decoration: none; }
.ithread.on { background: var(--teal-pale); }
.ithread .itname { font-size: 13px; font-weight: 700; }
.ithread .itprev { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-thread { padding: 18px 24px 30px; overflow-y: auto; }
.inbox-thread .ith-head { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--border-light); }
.inbox-thread .ith-name { font-size: 15px; font-weight: 700; }
.inbox-thread .ith-meta { font-size: 12px; color: var(--muted); }
.imsg { max-width: 78%; margin-top: 16px; }
.imsg .im-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.imsg .im-bubble { background: var(--canvas); border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.55; }
.imsg.out { margin-left: auto; }
.imsg.out .im-bubble { background: var(--teal-pale); }
.ireply { border-top: 1px solid var(--border-light); padding: 14px 24px; display: flex; gap: 10px; }
.ireply textarea { flex: 1; min-height: 46px; border: 1px solid var(--border); border-radius: 4px; padding: 10px; font-family: var(--font-body); font-size: 13px; resize: vertical; }
@media (max-width: 900px) { .inbox-shell { grid-template-columns: 1fr; } .inbox-nav, .inbox-threads { display: none; } }

/* ---------- Progress bar (goals) ---------- */
.pbar { height: 8px; border-radius: 4px; background: var(--border-faint); overflow: hidden; }
.pbar > i { display: block; height: 100%; background: var(--orange); border-radius: 4px; }
.pbar.good > i { background: #00bda5; }

/* ---------- Docs / content page ---------- */
.doc-wrap { max-width: 760px; }
.doc-wrap h2 { font-size: 22px; font-weight: 700; margin-top: 4px; }
.doc-wrap h3 { font-size: 16px; font-weight: 700; margin-top: 26px; }
.doc-wrap p { font-size: 13.5px; line-height: 1.7; color: var(--ink); margin-top: 10px; }
.doc-wrap ul { margin: 10px 0 0 20px; font-size: 13.5px; line-height: 1.8; color: var(--ink); }
.doc-wrap .kbd-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-faint); }
.doc-wrap .kbd-row .klabel { font-size: 13.5px; color: var(--ink); }
.doc-wrap .kbd-row .kkeys { margin-left: auto; display: flex; gap: 4px; }
.doc-wrap .kkeys kbd {
  background: var(--canvas); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
  padding: 3px 8px; font-family: var(--font-body); font-size: 12px; font-weight: 700; color: var(--ink);
}

@media (max-width: 768px) {
  .settings-shell { grid-template-columns: 1fr; }
  .settings-nav { border-right: none; border-bottom: 1px solid var(--border-light); display: flex; overflow-x: auto; padding: 10px 8px; gap: 2px; scrollbar-width: none; }
  .settings-nav h4, .settings-nav .scap, .settings-nav .snback { display: none; }
  .settings-nav a { flex: none; white-space: nowrap; border-radius: 14px; padding: 7px 12px; }
  .settings-body { padding: 18px 16px 40px; }
  .srow { flex-wrap: wrap; }
  .srow input[type=text] { width: 100%; }
  .fb-shell { grid-template-columns: 1fr; }
  .fb-fields { border-right: none; border-bottom: 1px solid var(--border-light); max-height: 40vh; }
  .soc-shell { gap: 14px; }
  .wf-node { width: 220px; }
  .builder-top .bb-title { font-size: 13px; }
}
