/* base layout, components and older layers (preview tokens, login, admin, tables); later files override it. Load order matters: later files override earlier ones. */
/* Preview tokens only. Replace --fg-* with the company UI kit tokens in production. */
:root{
  --fg-bg:#f5f6f8;
  --fg-surface:#fff;
  --fg-text:#252c36;
  --fg-muted:#68717e;
  --fg-line:#dce0e6;
  --fg-accent:#355a79;
  --fg-soft:#edf2f7;
  --fg-danger:#a03835;
  --fg-warning:#825b20;
  --fg-stripe:#b9c2cc;
  color-scheme:light;
  font:14px/1.65 -apple-system,BlinkMacSystemFont,'PingFang TC','Microsoft JhengHei',sans-serif
}

body.dark{
  --fg-bg:#181c22;
  --fg-surface:#222830;
  --fg-text:#e7ecf2;
  --fg-muted:#acb7c4;
  --fg-line:#414b58;
  --fg-accent:#a4c4e1;
  --fg-soft:#2c3b4a;
  --fg-danger:#ffb4ab;
  --fg-warning:#e3c58e;
  --fg-stripe:#546171;
  color-scheme:dark
}

*{
  box-sizing:border-box
}
body{
  margin:0;
  background:var(--fg-bg);
  color:var(--fg-text);
  font-variant-numeric:tabular-nums
}
button,input,textarea,select{
  font:inherit;
  color:inherit
}
button,a,input,select,summary{
  touch-action:manipulation
}
button{
  cursor:pointer;
  background:var(--fg-surface);
  border:1px solid var(--fg-line);
  border-radius:5px;
  padding:6px 12px;
  min-height:34px
}
button:hover{
  border-color:var(--fg-accent);
  background:var(--fg-soft)
}
button.active,.primary{
  background:var(--fg-accent);
  border-color:var(--fg-accent);
  color:var(--fg-surface)
}
button:disabled{
  opacity:.45;
  cursor:not-allowed
}
a{
  color:var(--fg-accent)
}
input,textarea,select{
  border:1px solid var(--fg-line);
  border-radius:5px;
  padding:8px 10px;
  background:var(--fg-surface);
  max-width:100%
}
textarea{
  width:100%;
  resize:vertical
}
label{
  display:block;
  margin:12px 0
}
label input:not([type=checkbox]):not([type=radio]),label textarea{
  display:block;
  width:100%;
  margin-top:5px
}
input[type=checkbox],input[type=radio]{
  accent-color:var(--fg-accent)
}
:focus-visible{
  outline:2px solid var(--fg-accent);
  outline-offset:3px
}
h1{
  font-size:26px;
  line-height:1.35;
  margin:5px 0 10px;
  letter-spacing:-.025em
}
h2{
  font-size:16px;
  margin:0 0 12px
}
h3{
  font-size:14px;
  margin:12px 0
}
p{
  margin:8px 0 16px
}
small,.muted,.eyebrow{
  font-size:12px;
  color:var(--fg-muted)
}
.eyebrow{
  letter-spacing:.08em
}
.vendor-logo{
  display:block;
  width:142px;
  height:auto
}
.topbar{
  height:76px;
  background:var(--fg-surface);
  border-bottom:1px solid var(--fg-line);
  display:flex;
  align-items:center;
  gap:26px;
  padding:0 24px;
  position:sticky;
  top:0;
  z-index:20
}
.brand{
  display:flex;
  gap:16px;
  align-items:center;
  min-width:310px
}
.brand strong{
  display:block;
  line-height:1.35;
  font-size:16px
}
.brand small{
  font-size:12px
}
.brand-copy{
  border-left:1px solid var(--fg-line);
  padding-left:16px
}
.search-button{
  flex:1;
  max-width:460px;
  text-align:left;
  color:var(--fg-muted);
  background:var(--fg-bg)
}
.top-actions{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:12px
}
.account-menu{
  position:relative
}
.account-menu summary{
  cursor:pointer;
  list-style:none;
  padding:5px 12px;
  border:1px solid var(--fg-line);
  border-radius:5px
}
.account-menu .menu{
  position:absolute;
  right:0;
  top:54px;
  width:225px;
  background:var(--fg-surface);
  padding:10px;
  border:1px solid var(--fg-line);
  box-shadow:0 8px 30px #0002
}
.menu button,.menu a{
  display:block;
  width:100%;
  text-align:left;
  margin:3px 0
}
.layout{
  display:grid;
  grid-template-columns:220px minmax(0,1fr);
  min-height:calc(100vh - 76px)
}
.sidebar{
  background:var(--fg-surface);
  border-right:1px solid var(--fg-line);
  height:calc(100vh - 76px);
  position:sticky;
  top:76px;
  overflow:auto;
  padding:22px 12px
}
.sidebar nav>button{
  display:block;
  width:100%;
  text-align:left;
  border-color:transparent;
  margin:4px 0
}
.sidebar .nav-label{
  margin:22px 10px 8px;
  font-size:12px;
  color:var(--fg-muted)
}
.sidebar button.active{
  background:var(--fg-soft);
  color:var(--fg-accent);
  border-color:var(--fg-line)
}
.nav-icon{
  display:inline-grid;
  place-items:center;
  width:25px;
  height:24px;
  margin-right:8px;
  font-size:11px;
  border:1px solid var(--fg-line);
  border-radius:4px
}
.sidebar .recent{
  font-size:12px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap
}
.sidebar-foot{
  margin:26px 10px 8px;
  padding-top:16px;
  border-top:1px solid var(--fg-line);
  font-size:12px;
  color:var(--fg-muted)
}
.content{
  padding:32px;
  min-width:0
}
.page-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:20px;
  margin-bottom:24px
}
.page-head p{
  margin-bottom:0;
  max-width:800px
}
.toolbar,.actions,.tabs{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin:12px 0
}
.tabs{
  border-bottom:1px solid var(--fg-line);
  padding-bottom:12px
}
.tabs button{
  border-color:transparent
}
.tabs .active{
  background:var(--fg-soft);
  color:var(--fg-accent);
  border-color:var(--fg-line)
}
.panel{
  border:1px solid var(--fg-line);
  background:var(--fg-surface);
  border-radius:7px;
  padding:20px;
  margin:18px 0;
  min-width:0
}
.flush{
  padding:0
}
.grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:20px
}
.stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  border:1px solid var(--fg-line);
  background:var(--fg-surface);
  margin:20px 0;
  border-radius:6px
}
.stat{
  padding:18px;
  border-right:1px solid var(--fg-line)
}
.stat:last-child{
  border:0
}
.stat strong{
  display:block;
  font-size:25px;
  font-weight:550;
  margin:10px 0
}
.badge{
  display:inline-block;
  font-size:12px;
  border:1px solid var(--fg-line);
  border-radius:4px;
  padding:1px 6px;
  margin:2px 0
}
.danger,.error{
  color:var(--fg-danger)
}
.warn{
  color:var(--fg-warning)
}
.notice{
  padding:12px 16px;
  background:var(--fg-soft);
  border:1px solid var(--fg-line);
  border-left:3px solid var(--fg-accent);
  margin:16px 0
}
.notice.warn{
  border-left-color:var(--fg-warning)
}
.table-wrap{
  overflow:auto;
  max-width:100%;
  border:1px solid var(--fg-line);
  border-radius:5px;
  background:var(--fg-surface)
}
table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
  text-align:left
}
td,th{
  padding:10px 12px;
  border-bottom:1px solid var(--fg-line);
  overflow-wrap:anywhere
}
th{
  font-weight:500;
  color:var(--fg-muted);
  background:var(--fg-bg);
  position:sticky;
  top:0
}
tr:last-child td{
  border:0
}
tbody tr:hover{
  background:var(--fg-soft)
}
td button{
  font-size:12px;
  padding:4px 8px
}
progress{
  width:100%;
  height:7px;
  accent-color:var(--fg-accent)
}
.home{
  max-width:880px;
  margin:48px auto
}
.home .page-head{
  margin-bottom:30px
}
.home h1{
  font-size:32px
}
.home .modes{
  margin-bottom:24px
}
.chip{
  border-radius:20px;
  background:transparent;
  font-size:13px
}
.composer{
  background:var(--fg-surface);
  border:1px solid var(--fg-line);
  border-radius:9px;
  padding:16px;
  margin-top:20px;
  box-shadow:0 3px 12px #00000004
}
.composer:focus-within{
  border-color:var(--fg-accent)
}
.composer textarea{
  border:0;
  min-height:140px;
  padding:10px;
  outline:none
}
.composer .toolbar{
  justify-content:space-between;
  margin-bottom:0
}
.composer .tools{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap
}
.composer-footer{
  margin:14px 4px;
  font-size:12px;
  color:var(--fg-muted)
}
.plus{
  position:relative
}
.plus summary{
  cursor:pointer;
  border:1px solid var(--fg-line);
  padding:4px 12px;
  border-radius:5px
}
.plus .menu{
  background:var(--fg-surface);
  padding:10px;
  border:1px solid var(--fg-line);
  position:absolute;
  bottom:40px;
  width:235px;
  z-index:10
}
.picker{
  padding:12px;
  border:1px solid var(--fg-line);
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  max-height:230px;
  overflow:auto
}
.home-foot{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:20px;
  margin-top:44px
}
.home-foot article{
  border-top:1px solid var(--fg-line);
  padding-top:16px
}
.home-foot strong{
  font-size:14px
}
.catalog-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:16px
}
.catalog-card{
  display:flex;
  flex-direction:column;
  padding:20px;
  margin:0
}
.catalog-card .actions{
  margin-top:auto;
  padding-top:12px
}
.catalog-card p{
  font-size:13px
}
.monogram{
  display:grid;
  place-items:center;
  width:36px;
  height:36px;
  border:1px solid var(--fg-line);
  background:var(--fg-bg);
  border-radius:5px;
  font-size:12px;
  font-weight:600;
  margin-bottom:20px
}
.card-meta{
  border-top:1px solid var(--fg-line);
  padding-top:10px;
  color:var(--fg-muted);
  font-size:12px;
  margin:12px 0
}
.task-layout{
  display:grid;
  grid-template-columns:minmax(0,1fr) 310px;
  gap:24px
}
.task-main{
  min-width:0
}
.thread{
  background:var(--fg-surface);
  border:1px solid var(--fg-line);
  border-radius:6px;
  min-height:220px
}
.message{
  padding:24px;
  border-bottom:1px solid var(--fg-line)
}
.message:last-child{
  border:0
}
.message.user{
  background:var(--fg-soft)
}
.message p{
  white-space:pre-wrap
}
.task-panel{
  border-left:1px solid var(--fg-line);
  padding-left:20px;
  min-width:0
}
.task-panel .tabs{
  gap:4px
}
.task-panel button{
  font-size:12px
}
.drawer-toggle{
  display:none
}
.steps{
  padding-left:24px
}
.steps li{
  padding:14px 0;
  border-bottom:1px solid var(--fg-line)
}
.trace-layout{
  display:grid;
  grid-template-columns:110px minmax(0,1fr) 280px;
  gap:16px
}
.turns button{
  display:block;
  width:100%;
  margin:6px 0
}
.waterrow{
  display:grid;
  grid-template-columns:170px minmax(0,1fr);
  width:100%;
  text-align:left;
  align-items:center;
  gap:10px;
  border:0;
  border-bottom:1px solid var(--fg-line);
  border-radius:0;
  padding:8px
}
.track{
  position:relative;
  display:block;
  height:22px;
  background:var(--fg-bg)
}
.spanbar{
  position:absolute;
  top:2px;
  height:18px;
  min-width:4px;
  border:1px solid var(--fg-accent);
  background:var(--fg-surface)
}
.spanbar.LLM{
  background:var(--fg-soft)
}
.spanbar.TOOL{
  background:var(--fg-stripe);
  border-style:dashed
}
.spanbar.TOOL:after{
  content:'////';
  position:absolute;
  inset:0;
  overflow:hidden;
  font-size:11px;
  color:var(--fg-muted)
}
.policy-marker{
  position:absolute;
  right:0;
  color:var(--fg-danger);
  z-index:1
}
.selected{
  outline:2px solid var(--fg-accent);
  outline-offset:-2px;
  background:var(--fg-soft)
}
.detail-pane{
  padding:18px;
  border:1px solid var(--fg-line);
  background:var(--fg-surface);
  overflow-wrap:anywhere
}
.drawer-close{
  display:none
}
.hit{
  border-bottom:2px solid var(--fg-warning)
}
.replay-line{
  padding:16px;
  border-bottom:1px solid var(--fg-line)
}
.chart{
  width:100%;
  height:180px;
  color:var(--fg-accent)
}
.chart text{
  font-size:12px;
  fill:var(--fg-muted)
}
.bar{
  height:6px;
  background:var(--fg-line);
  margin:8px 0
}
.bar span{
  display:block;
  background:var(--fg-accent);
  height:100%
}
.resource{
  padding:12px 0;
  border-bottom:1px solid var(--fg-line)
}
.modal-backdrop{
  position:fixed;
  inset:0;
  background:#10192577;
  display:grid;
  place-items:center;
  z-index:100;
  padding:24px
}
.modal{
  width:min(760px,100%);
  max-height:90vh;
  overflow:auto;
  background:var(--fg-surface);
  border:1px solid var(--fg-line);
  padding:24px;
  border-radius:8px;
  box-shadow:0 16px 60px #0002
}
.modal header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
  margin-bottom:16px
}
.modal h2{
  margin:0
}
.modal-backdrop.drawer-backdrop{
  place-items:stretch end;
  padding:0
}
.drawer-backdrop .modal{
  border-radius:0;
  max-height:100vh;
  width:min(600px,100%)
}
pre{
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  font:12px/1.8 ui-monospace,monospace;
  background:var(--fg-bg);
  padding:16px
}
code{
  font-size:12px;
  overflow-wrap:anywhere
}
.toast{
  position:fixed;
  bottom:24px;
  left:50%;
  transform:translateX(-50%);
  background:var(--fg-text);
  color:var(--fg-surface);
  padding:12px 24px;
  z-index:200;
  border-radius:5px
}
.filter-popover{
  position:relative
}
.filter-popover>summary{
  border:1px solid var(--fg-line);
  padding:6px 12px;
  border-radius:20px;
  cursor:pointer
}
.filter-options{
  position:absolute;
  top:40px;
  left:0;
  background:var(--fg-surface);
  border:1px solid var(--fg-line);
  padding:12px;
  width:220px;
  max-height:300px;
  overflow:auto;
  z-index:15;
  box-shadow:0 6px 20px #0001
}
.filter-options label{
  margin:6px 0
}
.embed{
  border:1px solid var(--fg-line);
  min-height:280px;
  background:var(--fg-bg);
  padding:28px;
  display:grid;
  place-content:center;
  text-align:center
}
.login-page{
  min-height:100vh;
  display:grid;
  grid-template-columns:1fr 1fr;
  background:var(--fg-surface)
}
.login-story{
  background:var(--fg-bg);
  padding:70px 12%;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  border-right:1px solid var(--fg-line)
}
.login-story h1{
  font-size:42px;
  line-height:1.4;
  margin:50px 0 24px
}
.login-story .vendor-logo{
  width:210px
}
.login-form-wrap{
  display:grid;
  place-items:center;
  padding:50px
}
.login-card{
  width:min(390px,100%)
}
.login-card select,.login-submit{
  width:100%
}
/* Test environment: already signed in → offer to keep the current account next to switching. */
.resume-login{
  display:block;
  margin-top:12px;
  text-align:center;
  font-size:14px
}
.resume-login[hidden]{
  display:none
}
.login-card h1{
  margin-top:14px
}
.login-footer{
  font-size:12px;
  color:var(--fg-muted);
  margin-top:36px
}
.account-hint{
  font-size:12px;
  min-height:60px;
  color:var(--fg-muted);
  margin:12px 0
}
.full{
  width:100%
}
[hidden]{
  display:none!important
}

@media(max-width:1320px){
  .content{
  padding:24px
}
.layout{
  grid-template-columns:200px minmax(0,1fr)
}
.task-layout{
  grid-template-columns:minmax(0,1fr)
}
.task-panel,.detail-pane{
  display:none;
  position:fixed;
  right:0;
  top:76px;
  bottom:0;
  width:360px;
  background:var(--fg-surface);
  padding:20px;
  z-index:40;
  overflow:auto;
  box-shadow:-10px 0 30px #0001
}
.task-panel.open,.detail-pane.open{
  display:block
}
.drawer-toggle,.drawer-close{
  display:inline-block
}
.trace-layout{
  grid-template-columns:110px minmax(0,1fr)
}
.home{
  margin:28px auto
}
.catalog-grid{
  grid-template-columns:repeat(2,minmax(0,1fr))
}
.brand{
  min-width:300px
}
.topbar{
  gap:16px
}
.stat{
  padding:14px
}

}

@media(max-width:850px){
  .topbar{
  height:auto;
  min-height:76px;
  flex-wrap:wrap;
  padding:12px
}
.brand{
  min-width:0
}
.brand-copy{
  display:none
}
.search-button{
  order:3;
  max-width:none;
  flex-basis:100%
}
.layout{
  grid-template-columns:150px minmax(0,1fr)
}
.sidebar{
  top:120px;
  padding:12px 6px
}
.content{
  padding:16px
}
.grid,.catalog-grid,.home-foot{
  grid-template-columns:1fr
}
.stats{
  grid-template-columns:1fr 1fr
}
.page-head{
  display:block
}
.home h1{
  font-size:26px
}
.login-page{
  grid-template-columns:1fr
}
.login-story{
  padding:30px
}
.login-story h1{
  font-size:30px;
  margin:24px 0
}
.login-form-wrap{
  padding:30px
}
.trace-layout{
  grid-template-columns:1fr
}
.turns{
  display:flex;
  gap:8px
}
.waterrow{
  grid-template-columns:130px minmax(0,1fr)
}
.nav-icon{
  display:none
}

}

