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

:root {
  --teal:       #00A896;
  --teal-dark:  #007d6f;
  --teal-light: #e6f7f5;
  --teal-mid:   rgba(0,168,150,0.12);
  --navy:       #0D2B3E;
  --navy2:      #1a3d54;
  --bg:         #f5f7f9;
  --surface:    #ffffff;
  --surface2:   #f0f3f6;
  --border:     #e2e8ed;
  --border2:    #c8d4dc;
  --text:       #0D2B3E;
  --muted:      #6b8394;
  --muted2:     #99adb9;
  --sans:       'Inter', sans-serif;
  --mono:       'JetBrains Mono', monospace;
  --green:      #10b981;
  --green-dim:  rgba(16,185,129,0.1);
  --amber:      #f59e0b;
  --amber-dim:  rgba(245,158,11,0.1);
  --red:        #ef4444;
  --red-dim:    rgba(239,68,68,0.1);
  --radius:     10px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13px; line-height: 1.5; }

/* LAYOUT */
.shell { display: grid; grid-template-columns: 230px 1fr; grid-template-rows: 56px 1fr; height: 100vh; }
.topbar { grid-column: 1 / -1; background: var(--navy); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: relative; z-index: 10; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 0; overflow-y: auto; }
.main { overflow-y: auto; background: var(--bg); }

/* TOPBAR */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark { width: 30px; height: 30px; background: var(--teal); border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.logo-mark svg { width: 18px; height: 18px; fill: white; }
.logo-text { font-size: 16px; font-weight: 600; color: #fff; letter-spacing: -0.3px; }
.logo-sub { font-size: 11px; color: rgba(255,255,255,0.45); font-weight: 400; margin-left: 2px; }
.topbar-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.12); margin: 0 4px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.last-run { font-size: 12px; color: rgba(255,255,255,0.45); }
.pulse-dot { width: 7px; height: 7px; background: var(--teal); border-radius: 50%; animation: pulse 2.5s ease-in-out infinite; display: inline-block; margin-right: 6px; }
@keyframes pulse { 0%,100%{opacity:1;box-shadow:0 0 0 0 rgba(0,168,150,0.5)} 50%{opacity:0.7;box-shadow:0 0 0 5px rgba(0,168,150,0)} }
.run-btn { font-size: 12px; font-weight: 500; background: var(--teal); color: #fff; border: none; padding: 7px 16px; border-radius: 7px; cursor: pointer; transition: background 0.15s; display: flex; align-items: center; gap: 6px; }
.run-btn:hover { background: var(--teal-dark); }
.run-btn svg { width: 12px; height: 12px; fill: white; }
.user-pill { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); border-radius: 20px; padding: 4px 10px 4px 5px; }
.user-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-name { font-size: 12px; color: rgba(255,255,255,0.8); font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout-btn { background: none; border: none; cursor: pointer; color: rgba(255,255,255,0.4); display: flex; align-items: center; padding: 0; transition: color 0.15s; }
.signout-btn:hover { color: rgba(255,255,255,0.9); }

/* SIDEBAR */
.nav-section { padding: 0 10px 4px; }
.nav-label { font-size: 10px; font-weight: 600; color: var(--muted2); letter-spacing: 1.2px; text-transform: uppercase; padding: 8px 8px 4px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); transition: all 0.12s; font-size: 13px; font-weight: 400; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--teal-light); color: var(--teal-dark); font-weight: 500; }
.nav-icon { width: 16px; height: 16px; opacity: 0.6; flex-shrink: 0; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-badge { margin-left: auto; font-size: 10px; font-weight: 600; background: var(--red-dim); color: var(--red); padding: 1px 7px; border-radius: 20px; }
.sidebar-footer { margin: 20px 10px 0; padding: 12px 14px; background: var(--teal-light); border-radius: var(--radius); border: 1px solid rgba(0,168,150,0.2); }
.sf-label { font-size: 10px; font-weight: 600; color: var(--teal-dark); letter-spacing: 0.8px; text-transform: uppercase; margin-bottom: 6px; }
.sf-val { font-family: var(--mono); font-size: 12px; color: var(--teal-dark); font-weight: 500; }
.sf-sub { font-size: 11px; color: var(--teal); margin-top: 2px; }
.sf-dataset-card { padding: 6px 0; }
.sf-dataset-card + .sf-dataset-card { border-top: 1px solid rgba(0,168,150,0.15); margin-top: 4px; padding-top: 8px; }

/* VIEWS */
.view { display: none; padding: 28px; animation: fadeIn 0.2s ease; }
.view.active { display: block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.view-title { font-size: 18px; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
.view-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

/* METRIC CARDS */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden; }
.metric::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; }
.metric.blue::before { background: var(--teal); }
.metric.green::before { background: var(--green); }
.metric.amber::before { background: var(--amber); }
.metric.red::before { background: var(--red); }
.metric-label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 10px; }
.metric-val { font-size: 32px; font-weight: 600; line-height: 1; color: var(--navy); }
.metric-sub { font-size: 11px; color: var(--muted); margin-top: 5px; }

/* SECTION HEADER */
.section-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--navy); }
.filter-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; margin-bottom: 16px; width: 100%; overflow: hidden; }
.filter-pill { flex-shrink: 0; font-size: 13px; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid #d1d9e0; border-radius: 7px; padding: 0 12px; cursor: pointer; outline: none; height: 36px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' stroke='%2399adb9' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; transition: border-color 0.12s; font-family: var(--sans); }
.filter-pill:hover { border-color: #b0bec8; }
.filter-pill:focus { border-color: var(--teal); }
.search-pill { flex-shrink: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid #d1d9e0; border-radius: 7px; padding: 0 12px; height: 36px; color: #b0bec8; transition: border-color 0.12s; }
.search-pill:focus-within { border-color: var(--teal); color: var(--muted); }
.search-pill input { border: none; outline: none; font-size: 13px; color: var(--text); background: transparent; width: 160px; font-family: var(--sans); min-width: 0; }
.search-pill input::placeholder { color: #b0bec8; }
.hide-filters-btn { flex-shrink: 0; margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--text); background: #edf0f3; border: 1px solid #d1d9e0; border-radius: 7px; padding: 0 14px; height: 36px; cursor: pointer; transition: background 0.12s; font-family: var(--sans); white-space: nowrap; }
.hide-filters-btn:hover { background: #e2e6ea; }
.hide-filters-btn svg { color: var(--muted); }
.filter-tabs { display: flex; gap: 4px; background: var(--surface2); border-radius: 8px; padding: 3px; }
.ftab { font-size: 12px; font-weight: 500; padding: 4px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); transition: all 0.12s; }
.ftab:hover { color: var(--text); }
.ftab.active { background: var(--surface); color: var(--navy); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* TABLE */
.tbl-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg); border-bottom: 1px solid var(--border); }
th { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; padding: 10px 16px; text-align: left; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.tbl-row { cursor: pointer; transition: background 0.1s; }
tr.tbl-row:hover td { background: var(--teal-light); }
.tname { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--navy); }
.tdataset { font-size: 11px; color: var(--muted2); margin-top: 1px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; letter-spacing: 0.2px; }
.badge.healthy { background: var(--green-dim); color: #059669; }
.badge.warning { background: var(--amber-dim); color: #d97706; }
.badge.critical { background: var(--red-dim); color: #dc2626; }
.badge::before { content:''; width:5px; height:5px; border-radius:50%; background: currentColor; }
.health-reason { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.num { font-family: var(--sans); font-size: 13px; color: var(--text); }
.num.dim { color: var(--muted2); }
.num.warn { color: var(--amber); font-weight: 500; }
.num.crit { color: var(--red); font-weight: 500; }
.ago { font-size: 12px; color: var(--muted); }
.ago.stale { color: var(--amber); font-weight: 500; }
.action-btn { font-size: 11px; font-weight: 500; background: none; border: 1px solid var(--border2); color: var(--muted); padding: 4px 10px; border-radius: 6px; cursor: pointer; transition: all 0.12s; }
.action-btn:hover { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-light); }
.action-btn.dedup-btn { border-color: var(--amber); color: var(--amber); }
.action-btn.dedup-btn:hover { border-color: var(--amber); color: #fff; background: var(--amber); }

/* AGENT LOG */
.run-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.run-hd { display: grid; grid-template-columns: 140px 130px 80px 70px 70px 1fr auto; align-items: center; gap: 16px; padding: 13px 18px; cursor: pointer; }
.run-hd:hover { background: var(--bg); }
.run-id { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--teal-dark); }
.run-time { font-size: 12px; color: var(--muted); }
.run-stat { font-family: var(--mono); font-size: 12px; }
.run-trigger { font-size: 11px; font-weight: 500; background: var(--surface2); border: 1px solid var(--border); padding: 2px 9px; border-radius: 20px; color: var(--muted); }
.run-chevron { font-size: 10px; color: var(--muted2); transition: transform 0.2s; }
.run-body { display: none; padding: 14px 18px 16px; border-top: 1px solid var(--border); background: var(--bg); }
.run-body.open { display: block; }
.run-summary { font-size: 13px; color: var(--muted); line-height: 1.65; }
.run-summary strong { color: var(--navy); font-weight: 600; }

/* CHART PANEL */
.chart-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.tbl-history-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; overflow-x: auto; }
.tbl-history { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl-history thead th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 0 12px 10px; border-bottom: 1px solid var(--border); }
.tbl-history tbody tr { border-bottom: 1px solid var(--border); }
.tbl-history tbody tr:last-child { border-bottom: none; }
.tbl-history tbody td { padding: 10px 12px; }
.chart-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }
.chart-wrap { height: 160px; }

/* CHAT */
.chat-shell { display: flex; flex-direction: column; height: calc(100vh - 56px - 56px); max-height: 700px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-start; animation: fadeIn 0.2s ease; }
.msg.user { flex-direction: row-reverse; }
.msg-avatar { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.msg.agent .msg-avatar { background: var(--teal); color: white; }
.msg.user .msg-avatar { background: var(--navy); color: white; }
.msg-bubble { border-radius: 10px; padding: 10px 14px; max-width: 72%; font-size: 13px; line-height: 1.6; }
.msg.agent .msg-bubble { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.msg.user .msg-bubble { background: var(--navy); color: rgba(255,255,255,0.9); }
.msg-bubble .mono { font-family: var(--mono); color: var(--teal-dark); font-size: 11px; font-weight: 500; background: var(--teal-light); padding: 1px 6px; border-radius: 4px; }
.msg.user .msg-bubble .mono { color: #7de8dc; background: rgba(0,168,150,0.2); }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 20px 14px; }
.chip { font-size: 12px; font-weight: 500; background: var(--surface); border: 1px solid var(--border2); padding: 6px 13px; border-radius: 20px; color: var(--muted); cursor: pointer; transition: all 0.12s; }
.chip:hover { color: var(--teal-dark); border-color: var(--teal); background: var(--teal-light); }
.chat-input-row { border-top: 1px solid var(--border); padding: 14px 20px; display: flex; gap: 10px; background: var(--surface); }
.chat-input { flex: 1; background: var(--bg); border: 1px solid var(--border2); border-radius: 8px; padding: 9px 14px; color: var(--text); font-family: var(--sans); font-size: 13px; outline: none; transition: border-color 0.15s; }
.chat-input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,168,150,0.1); }
.chat-input::placeholder { color: var(--muted2); }
.chat-send { background: var(--teal); color: white; border: none; border-radius: 8px; padding: 9px 18px; font-size: 12px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.chat-send:hover { background: var(--teal-dark); }
.typing { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing span { width: 6px; height: 6px; background: var(--muted2); border-radius: 50%; animation: blink 1.2s ease-in-out infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100%{opacity:0.25} 40%{opacity:1} }

/* DETAIL */
.detail-hd { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.detail-back { font-size: 12px; font-weight: 500; color: var(--muted); cursor: pointer; background: none; border: 1px solid var(--border); padding: 5px 12px; border-radius: 7px; display: flex; align-items: center; gap: 5px; transition: all 0.12s; }
.detail-back:hover { color: var(--teal-dark); border-color: var(--teal); background: var(--teal-light); }
.detail-name { font-family: var(--sans); font-size: 17px; font-weight: 600; color: var(--navy); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.dc-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.dc-val { font-size: 22px; font-weight: 600; color: var(--navy); }
.dc-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.missing-dates { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.date-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.date-chip { font-family: var(--mono); font-size: 11px; background: var(--red-dim); color: #dc2626; padding: 3px 10px; border-radius: 20px; font-weight: 500; }
.refresh-btn { font-size: 13px; font-weight: 600; background: var(--teal); color: white; border: none; padding: 9px 20px; border-radius: 8px; cursor: pointer; transition: background 0.15s; }
.refresh-btn:hover { background: var(--teal-dark); }

/* CONFIG */
.cfg-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.add-btn { display: flex; align-items: center; gap: 7px; background: var(--teal); color: white; border: none; padding: 8px 18px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.add-btn:hover { background: var(--teal-dark); }
.cfg-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.cfg-row { border-bottom: 1px solid var(--border); }
.cfg-row:last-child { border-bottom: none; }
.cfg-row.hd { background: var(--bg); display: grid; grid-template-columns: 2fr 120px 72px 100px 150px 1fr 110px 90px; align-items: center; }
.cfg-row-main { display: grid; grid-template-columns: 2fr 120px 72px 100px 150px 1fr 110px 90px; align-items: center; transition: background 0.1s; }
.cfg-row-main:hover { background: #f8fbfa; }
.cfg-row-sub { display: flex; align-items: center; gap: 8px; padding: 0 16px 10px; flex-wrap: wrap; }
.bq-label { font-size: 10px; font-weight: 600; color: var(--muted2); text-transform: uppercase; letter-spacing: 0.8px; margin-right: 2px; }
.bq-tag { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10px; font-weight: 500; padding: 3px 8px; border-radius: 4px; }
.bq-tag.partition { background: rgba(245,158,11,0.1); color: #b45309; border: 1px solid rgba(245,158,11,0.2); }
.bq-tag.cluster   { background: rgba(139,92,246,0.1);  color: #6d28d9; border: 1px solid rgba(139,92,246,0.2); }
.bq-tag.none      { background: var(--surface2); color: var(--muted2); border: 1px solid var(--border); font-style: italic; }
.bq-sep { width: 1px; height: 14px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
.n8n-link { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 11px; color: var(--teal-dark); background: var(--teal-light); border: 1px solid rgba(0,168,150,0.2); padding: 3px 9px; border-radius: 5px; text-decoration: none; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: all 0.12s; }
.n8n-link:hover { background: rgba(0,168,150,0.2); }
.n8n-link svg { flex-shrink: 0; }
.n8n-na { font-size: 11px; color: var(--muted2); font-style: italic; }
.cfg-cell { padding: 11px 16px; font-size: 12px; min-width: 0; text-align: center; }
.cfg-cell:first-child { text-align: left; }
.cfg-row.hd .cfg-cell { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 16px; text-align: center; }
.cfg-row.hd .cfg-cell:first-child { text-align: left; }
.cfg-tname { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cfg-db { font-family: var(--sans); font-size: 13px; color: var(--muted); }
.type-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.type-badge.fact { background: rgba(59,130,246,0.1); color: #2563eb; }
.type-badge.dim  { background: rgba(139,92,246,0.1); color: #7c3aed; }
.cfg-col { font-family: var(--sans); font-size: 13px; color: var(--muted); }
.cfg-col.set { color: var(--navy); font-weight: 500; }
.cfg-col.na { color: var(--muted2); font-style: italic; }
.cfg-actions { display: flex; gap: 6px; padding: 0 24px 0 8px; justify-content: flex-end; }
.icon-btn { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); transition: all 0.12s; flex-shrink: 0; }
.icon-btn:hover.edit { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-light); }
.icon-btn:hover.del  { border-color: var(--red); color: var(--red); background: var(--red-dim); }

/* MODAL */
.modal-backdrop { position: fixed; inset: 0; background: rgba(13,43,62,0.45); z-index: 100; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.15s ease; }
.modal { background: var(--surface); border-radius: 14px; width: 520px; max-width: calc(100vw - 32px); box-shadow: 0 20px 60px rgba(13,43,62,0.2); overflow: hidden; }
.modal-hd { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; color: var(--navy); }
.modal-close { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 16px; transition: all 0.12s; }
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-ft { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--bg); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.3px; }
.field input, .field select { background: var(--bg); border: 1px solid var(--border2); border-radius: 7px; padding: 8px 12px; color: var(--text); font-family: var(--sans); font-size: 13px; outline: none; transition: border-color 0.15s; width: 100%; }
.field input:focus, .field select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,168,150,0.1); }
.field input::placeholder { color: var(--muted2); }
.field select:disabled { opacity: 0.5; cursor: not-allowed; }
.fact-only { transition: opacity 0.2s; }
.fact-only.hidden { opacity: 0.3; pointer-events: none; }
.type-toggle { display: flex; gap: 0; border: 1px solid var(--border2); border-radius: 8px; overflow: hidden; }
.type-opt { flex: 1; padding: 8px; text-align: center; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); background: var(--bg); transition: all 0.12s; border: none; }
.type-opt.active.fact { background: rgba(59,130,246,0.1); color: #2563eb; }
.type-opt.active.dim  { background: rgba(139,92,246,0.1); color: #7c3aed; }
.hint { font-size: 11px; color: var(--muted2); margin-top: 2px; }
.btn-secondary { font-size: 13px; font-weight: 500; background: none; border: 1px solid var(--border2); color: var(--muted); padding: 8px 18px; border-radius: 8px; cursor: pointer; transition: all 0.12s; }
.btn-secondary:hover { background: var(--bg); color: var(--text); }
.btn-primary { font-size: 13px; font-weight: 600; background: var(--teal); color: white; border: none; padding: 8px 20px; border-radius: 8px; cursor: pointer; transition: background 0.15s; }
.btn-primary:hover { background: var(--teal-dark); }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--navy); color: white; padding: 10px 18px; border-radius: 8px; font-size: 13px; font-weight: 500; z-index: 200; animation: slideUp 0.25s ease; box-shadow: 0 8px 24px rgba(13,43,62,0.25); }
@keyframes slideUp { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.3; display: block; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* AGENT SETTINGS */
.agent-settings-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.agent-settings-row { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
.agent-settings-col { display: flex; flex-direction: column; gap: 6px; }
.as-label { font-size: 12px; font-weight: 600; color: var(--navy); text-transform: uppercase; letter-spacing: 0.5px; }
.as-sub { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.as-textarea { width: 100%; resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--text); background: var(--bg); border: 1px solid var(--border2); border-radius: 8px; padding: 12px; outline: none; transition: border 0.15s; }
.as-textarea:focus { border-color: var(--teal); }
.as-tools-list { display: flex; flex-direction: column; gap: 8px; }
.as-tool { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: background 0.12s; }
.as-tool:hover { background: var(--bg); }
.as-tool input[type=checkbox] { margin-top: 2px; accent-color: var(--teal); width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
.as-tool-info { display: flex; flex-direction: column; gap: 2px; }
.as-tool-name { font-size: 12px; font-weight: 600; color: var(--navy); font-family: var(--mono); }
.as-tool-desc { font-size: 11px; color: var(--muted); }

/* USERS VIEW */
.users-wrap { display: flex; flex-direction: column; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.user-row { display: grid; grid-template-columns: 44px 1fr 110px 1fr auto; align-items: center; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: none; }
.user-row:hover { background: var(--bg); }
.user-initials { width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: white; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-initials.admin-mark { background: var(--navy); }
.user-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-name-cell { font-size: 13px; font-weight: 500; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email-cell { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-sel { font-size: 12px; font-weight: 500; color: var(--text); background: var(--surface); border: 1px solid var(--border2); border-radius: 6px; padding: 4px 24px 4px 8px; cursor: pointer; outline: none; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2399adb9' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; font-family: var(--sans); }
.user-role-sel:focus { border-color: var(--teal); }
.user-role-sel:disabled { opacity: 0.5; cursor: default; }
.ds-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-chip { font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 20px; border: 1px solid var(--border2); color: var(--muted); cursor: pointer; transition: all 0.12s; user-select: none; }
.ds-chip:hover { border-color: var(--teal); color: var(--teal-dark); }
.ds-chip.on { background: var(--teal-light); border-color: var(--teal); color: var(--teal-dark); font-weight: 600; }
.ds-chip.disabled { pointer-events: none; opacity: 0.45; }
.ds-all-label { font-size: 11px; color: var(--muted); font-style: italic; }
.invite-form { margin-bottom: 20px; }
.invite-form-inner { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.invite-ds-hint { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
