:root {
  color-scheme: dark;
  --bg: #070b12;
  --panel: rgba(16, 23, 35, .86);
  --line: rgba(255, 255, 255, .09);
  --text: #f5f7fb;
  --muted: #8f9bad;
  --cyan: #35d7ff;
  --pink: #8b7cff;
  --gold: #ffd166;
  --red: #ff5d68;
}

/* Nana Mail v1.1 — aurora mail flow */
.topbar { background: rgba(5,10,22,.9); border-bottom-color: rgba(53,215,255,.18); }
.brand img { border-color: rgba(53,215,255,.72); box-shadow: 0 0 28px rgba(53,215,255,.2); }
.panel { background: linear-gradient(145deg,rgba(16,25,45,.94),rgba(8,14,28,.92)); }
.flow-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:16px 0 10px; padding:10px 12px; border:1px solid rgba(53,215,255,.2); border-radius:12px; background:rgba(53,215,255,.045); }
.flow-toolbar strong { color:var(--cyan); font-size:11px; letter-spacing:.16em; }
.flow-toolbar span { color:var(--muted); font-size:10px; text-align:right; }
.mail-flow { display:grid; grid-template-columns:repeat(5,minmax(190px,1fr)); gap:10px; overflow-x:auto; padding:2px 2px 12px; }
.flow-column { min-height:330px; padding:9px; border:1px solid var(--line); border-radius:15px; background:rgba(3,8,18,.48); transition:.18s ease; }
.flow-column > header { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:8px; padding:4px 3px 11px; }
.flow-column > header span { display:grid; place-items:center; width:25px; height:25px; border-radius:8px; color:var(--cyan); background:rgba(53,215,255,.1); font-size:9px; font-weight:900; }
.flow-column > header strong { font-size:10px; letter-spacing:.1em; }
.flow-column > header b { display:grid; place-items:center; min-width:23px; height:23px; padding:0 6px; border-radius:999px; background:#19243a; color:#b7c5d9; font-size:9px; }
.flow-dropzone { min-height:270px; display:grid; align-content:start; gap:8px; }
.flow-column.drag-over { border-color:var(--cyan); background:rgba(53,215,255,.08); box-shadow:inset 0 0 30px rgba(53,215,255,.06); transform:translateY(-2px); }
.flow-review > header span { color:#ffd166; background:rgba(255,209,102,.1); }
.flow-internal > header span { color:#63e8a4; background:rgba(99,232,164,.1); }
.flow-customer > header span { color:#a99cff; background:rgba(139,124,255,.12); }
.flow-blocked > header span { color:#ff7b85; background:rgba(255,93,104,.1); }
.mail-flow .log-item { padding:11px; cursor:grab; background:linear-gradient(145deg,#101b30,#0a1222); box-shadow:0 8px 24px rgba(0,0,0,.16); }
.mail-flow .log-item:active { cursor:grabbing; }
.mail-flow .log-item.dragging { opacity:.42; transform:scale(.98); }
.mail-flow .log-head { display:grid; gap:3px; }
.mail-flow .log-head span { font-size:8px; line-height:1.35; }
.mail-flow .log-item p { max-height:92px; overflow:hidden; font-size:10px; }
.mail-flow .classify { display:grid; gap:5px; }
.mail-flow .classify button { padding:7px; font-size:9px; }
@media (max-width:1100px) { .mail-flow { grid-template-columns:repeat(5,220px); } }
@media (max-width:700px) { .flow-toolbar { align-items:flex-start; flex-direction:column; } .flow-toolbar span { text-align:left; } }
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(64,224,208,.14), transparent 31rem),
    radial-gradient(circle at 90% 10%, rgba(255,77,154,.13), transparent 35rem),
    var(--bg);
}
button, select, textarea { font: inherit; }
button {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  background: #182234;
  cursor: pointer;
}
button:hover { border-color: rgba(64,224,208,.5); }
button.primary { color: #021412; background: var(--cyan); font-weight: 800; }
button.ghost { background: transparent; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(7,11,18,.84);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.brand img { width: 43px; height: 43px; object-fit: cover; border-radius: 50%; border: 1px solid rgba(255,77,154,.7); box-shadow: 0 0 24px rgba(255,77,154,.24); }
.topbar nav { display: flex; align-self: stretch; gap: 4px; }
.topbar nav button { border: 0; border-radius: 0; padding: 0 17px; color: var(--muted); background: transparent; }
.topbar nav button.active { color: #ff7ab4; border-bottom: 2px solid var(--pink); box-shadow: inset 0 -12px 22px rgba(255,77,154,.06); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(22px, 3vw, 34px); }
h2 { margin-bottom: 0; font-size: clamp(19px, 2vw, 27px); }
.eyebrow {
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
}
.status { color: var(--muted); font-size: 13px; }
.status span {
  display: inline-block;
  width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #ffd166;
}
.vault-open .status span { background: #52e08f; box-shadow: 0 0 14px #52e08f; }
.workspace-shell {
  width: min(1920px, 100%);
  margin: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: 235px minmax(600px, 1fr) 255px;
  gap: 12px;
  align-items: start;
}
.workspace-main { min-width: 0; }
.bot-command { display: grid; grid-template-columns: minmax(260px,1fr) 180px minmax(260px,1fr); align-items: center; gap: 10px; margin-bottom: 12px; }
.bot-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  min-height: 84px; padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(135deg,rgba(17,27,42,.96),rgba(10,15,25,.96));
}
.bot-card.query { border-color: rgba(64,224,208,.3); box-shadow: inset 0 0 28px rgba(64,224,208,.035); }
.bot-card.review { border-color: rgba(255,77,154,.35); box-shadow: inset 0 0 28px rgba(255,77,154,.04); }
.bot-id { padding: 7px; border-radius: 8px; color: var(--cyan); background: rgba(64,224,208,.08); font-size: 9px; font-weight: 900; }
.bot-card.review .bot-id { color: #ff88bd; background: rgba(255,77,154,.09); }
.bot-card strong { font-size: 17px; }.bot-card p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.bot-card b { color: #65e5a5; font-size: 8px; letter-spacing: .12em; }
.bot-card.review b { color: var(--gold); }
.bot-route { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; text-align: center; }
.bot-route i { flex: 1; height: 1px; background: linear-gradient(90deg,var(--cyan),var(--pink)); }
.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(16px, 2.4vw, 28px);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0,0,0,.22);
}
.provider-rail, .inspector { position: sticky; top: 85px; padding: 13px; border-radius: 14px; }
.rail-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; color: #ff8cbc; font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.rail-title button { padding: 4px 8px; }
.provider-node {
  position: relative;
  display: grid;
  grid-template-columns: 31px 1fr auto;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.018);
}
.provider-node::before { content: ""; position: absolute; left: -1px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.provider-node:nth-child(even)::before { background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.provider-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #172438; color: var(--cyan); font-weight: 900; }
.provider-node strong, .provider-node small { display: block; }
.provider-node strong { font-size: 12px; }.provider-node small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.provider-node b { width: 7px; height: 7px; border-radius: 50%; background: #53e39a; }
.rail-note { margin-top: 18px; padding: 12px; border: 1px solid rgba(255,77,154,.18); border-radius: 10px; background: rgba(255,77,154,.035); }
.rail-note strong { font-size: 11px; color: #ff8cbc; }.rail-note p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.online { color: #63e8a4; font-size: 9px; }
.health-ring {
  width: 118px; height: 118px; margin: 18px auto;
  border-radius: 50%; display: grid; place-content: center; text-align: center;
  border: 7px solid #1e3f36;
  box-shadow: inset 0 0 0 2px #50e399, 0 0 25px rgba(80,227,153,.14);
}
.health-ring strong { font-size: 26px; }.health-ring span { color: var(--muted); font-size: 9px; }
.vault-control { display: grid; gap: 9px; padding: 12px; border: 1px solid rgba(255,77,154,.22); border-radius: 10px; background: rgba(255,77,154,.04); }
.vault-control input { width: 100%; padding: 10px; color: var(--text); border: 1px solid var(--line); border-radius: 9px; background: #0c1320; }
.vault-control div { display: flex; gap: 7px; }.vault-control div button { flex: 1; padding: 8px 5px; font-size: 10px; }
.vault-control small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.inspect-block { display: flex; justify-content: space-between; gap: 10px; padding: 11px 4px; border-top: 1px solid var(--line); }
.inspect-block span { color: var(--muted); font-size: 10px; }.inspect-block strong { font-size: 10px; color: #dce5f1; }
.inspect-block strong.integrity-failed { color: var(--red); }
.route-map { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.route-map > div { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; color: #cbd5e2; font-size: 8px; }
.route-map i { flex: 1; height: 1px; margin: 0 4px; background: linear-gradient(90deg,var(--cyan),var(--pink)); }
.full { width: 100%; margin-top: 12px; }
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}
textarea, select {
  width: 100%;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px;
  background: #0c1320;
  resize: vertical;
}
textarea:focus, select:focus { outline: 2px solid rgba(64,224,208,.35); border-color: var(--cyan); }
.composer textarea { min-height: 105px; font-size: 17px; }
.security-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 10px 12px; border: 1px solid rgba(64,224,208,.2); border-radius: 10px; background: rgba(64,224,208,.05); }
.visibility-control { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; padding: 13px 15px; border-color: rgba(255,74,155,.32); }
.visibility-control > div { margin-right: auto; }
.visibility-control label { display: flex; align-items: center; gap: 7px; margin: 0; }
.visibility-control select { min-width: 125px; }
.visibility-control small { flex-basis: 100%; color: var(--muted); }
.security-command {
  margin-bottom: 16px;
  border-color: rgba(64,224,208,.25);
  background:
    linear-gradient(135deg,rgba(64,224,208,.045),rgba(255,77,154,.045)),
    var(--panel);
}
.security-command-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 15px; }
.master-state { padding: 9px 12px; border-radius: 999px; color: #7df0ad; border: 1px solid rgba(82,224,143,.35); background: rgba(82,224,143,.08); font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.master-state.locked { color: #ff8f97; border-color: rgba(255,93,104,.45); background: rgba(255,93,104,.09); }
.gate-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; }
.gate-grid article { min-height: 88px; padding: 12px; display: grid; grid-template-columns: auto 1fr; gap: 9px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4,9,17,.58); }
.gate-grid i { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: var(--cyan); background: rgba(64,224,208,.09); font-size: 9px; font-style: normal; font-weight: 900; }
.gate-grid strong,.gate-grid small,.gate-grid b { display: block; }
.gate-grid strong { font-size: 11px; }.gate-grid small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.gate-grid b { grid-column: 1/-1; color: var(--gold); font-size: 8px; letter-spacing: .12em; }
.route-lock { display: flex; align-items: center; gap: 7px; margin-top: 13px; padding: 11px; overflow: auto; border: 1px solid rgba(255,77,154,.2); border-radius: 11px; color: #bfcbda; font-size: 8px; white-space: nowrap; }
.route-lock i { min-width: 20px; flex: 1; height: 1px; background: linear-gradient(90deg,var(--cyan),var(--pink)); }
.route-lock em { padding: 6px 9px; border-radius: 7px; color: #ff8cbc; background: rgba(255,77,154,.11); font-style: normal; font-weight: 900; }
.vault-shield { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3,6,12,.88); backdrop-filter: blur(18px); }
.vault-open .vault-shield { display: none; }
.shield-card { width: min(440px,100%); padding: 30px; text-align: center; border: 1px solid rgba(255,77,154,.42); border-radius: 22px; background: linear-gradient(145deg,#121b2a,#080d16); box-shadow: 0 0 70px rgba(255,77,154,.13); }
.shield-card img { width: 76px; height: 76px; object-fit: cover; border-radius: 50%; border: 1px solid var(--pink); box-shadow: 0 0 30px rgba(255,77,154,.35); }
.shield-card h2 { margin-top: 8px; font-size: 29px; }.shield-card p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.shield-card input { width: 100%; margin: 8px 0 10px; padding: 14px; color: var(--text); border: 1px solid var(--line); border-radius: 12px; background: #070d17; }
.shield-card button { width: 100%; }.shield-card small { display: block; margin-top: 13px; color: var(--muted); font-size: 9px; }
.switch { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); }
.switch.forced { border-color: rgba(82,224,143,.35); color: #8bf0b4; }
.danger-button { border-color: rgba(255,93,104,.55); color: #ff8f97; }
.danger-button.stopped { background: rgba(255,93,104,.18); box-shadow: 0 0 22px rgba(255,93,104,.15); }
.hide-providers .provider-rail { display: none; }
.hide-bots .bot-command { display: none; }
.hide-logs .review-grid { display: none; }
.hide-inspector .inspector { display: none; }
.hide-providers.hide-inspector .workspace-shell { grid-template-columns: minmax(0,1fr); }
body[data-role="customer"] .visibility-control { border-color: rgba(255,209,102,.4); }
body[data-role="customer"] .visibility-control small::before { content: "BẢN XEM THỬ • "; color: var(--gold); font-weight: 700; }
.security-strip label { display: flex; align-items: center; gap: 8px; margin: 0; color: #bdf8f2; }
.composer-actions { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-top: 13px; }
.composer-actions label { min-width: 130px; }
label { display: grid; gap: 7px; margin-top: 13px; color: var(--muted); font-size: 13px; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.wall-section { margin-top: 34px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot.ready { background: #52e08f; } .dot.review { background: var(--gold); }
.wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 12px;
}
.screen {
  min-height: 205px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(22,32,48,.95), rgba(11,17,28,.95));
}
.screen.asked { border-color: rgba(255,209,102,.55); }
.screen-top { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.provider-badge { margin-left: auto; padding: 5px 8px; border-radius: 99px; color: var(--cyan); background: rgba(64,224,208,.08); }
.provider-name { margin-bottom: 6px; font-size: 21px; }
.provider-role { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.screen-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.screen-actions button { padding: 9px 8px; font-size: 12px; }
.check input { display: none; }
.check span { width: 16px; height: 16px; border: 1px solid #526078; border-radius: 5px; display: block; }
.check input:checked + span { background: var(--cyan); box-shadow: inset 0 0 0 3px #12202b; }
.review-grid { display: grid; grid-template-columns: minmax(310px,.8fr) minmax(380px,1.2fr); gap: 16px; margin-top: 34px; }
.scan-result { margin-top: 14px; padding: 12px; border-radius: 12px; font-size: 13px; }
.scan-result.neutral { background: #101827; color: var(--muted); }
.scan-result.safe { background: rgba(82,224,143,.1); color: #8bf0b4; }
.scan-result.warn { background: rgba(255,209,102,.1); color: var(--gold); }
.scan-result.danger { background: rgba(255,93,104,.1); color: #ff8f97; }
.tray-stats { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; }
.tray-stats div { padding: 12px 8px; border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.tray-stats strong, .tray-stats span { display: block; }
.tray-stats strong { font-size: 22px; }.tray-stats span { color: var(--muted); font-size: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 16px 0; }
.filters button { padding: 7px 10px; font-size: 11px; }
.filters button.active { border-color: var(--cyan); color: var(--cyan); }
.logs { max-height: 500px; overflow: auto; display: grid; gap: 9px; }
.logs.empty { min-height: 170px; place-items: center; color: var(--muted); }
.log-item { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #0c1320; }
.log-head { display: flex; justify-content: space-between; gap: 10px; }
.log-head span { color: var(--cyan); font-size: 11px; }
.log-item p { margin: 8px 0; color: #c9d1dd; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.classify { display: flex; flex-wrap: wrap; gap: 6px; }
.classify button { padding: 5px 8px; font-size: 10px; }
.classify button.selected { background: var(--cyan); color: #031716; }
@media (min-width: 1450px) {
  .wall[data-count="30"], .wall[data-count="40"], .wall[data-count="50"] { grid-template-columns: repeat(5, 1fr); }
  .wall[data-count="50"] .screen { min-height: 170px; }
}
@media (max-width: 820px) {
  .topbar { align-items: flex-start; }
  .status { display: none; }
  .review-grid { grid-template-columns: 1fr; }
  .tray-stats { grid-template-columns: repeat(3,1fr); }
  .screen-actions { grid-template-columns: 1fr; }
  .gate-grid { grid-template-columns: 1fr 1fr; }
  .gate-grid article:last-child { grid-column: 1/-1; }
}
@media (max-width: 1220px) {
  .workspace-shell { grid-template-columns: 210px minmax(540px,1fr); }
  .inspector { display: none; }
  .topbar nav { display: none; }
}
@media (max-width: 860px) {
  .workspace-shell { display: block; }
  .provider-rail { position: static; margin-bottom: 12px; }
  #providerRail { display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; }
  .bot-command { grid-template-columns: 1fr; }
  .bot-route { padding: 0 30px; }
}
